views:

21

answers:

0
cd \.
cd Source\2010
for /l %%i in (1,1,9) do (
if exist 0%%i\NUL ( 
cd 0%%i 
for /l %%j in (1,1,9) do (
    if exist 0%%j\NUL ( 
    cd 0%%j
    d:\Renamer\ReNamer.exe /rename "telegraf-rename" "*"
    cd ..
    )
    echo 0%%i
    )
for /l %%k in (10,1,31) do (
    if exist %%k\NUL ( 
    cd %%k
    d:\Renamer\ReNamer.exe /rename "telegraf-rename" "*"
    cd ..
    )
    echo %%k
    )
cd ..
)
echo 0%%i
)
for /l %%l in (10,1,12) do (
if exist %%l\NUL ( 
cd %%l 
for /l %%m in (1,1,9) do (
    if exist 0%%m\NUL ( 
    cd 0%%m
    d:\Renamer\ReNamer.exe /rename "telegraf-rename" "*"
    cd ..
    )
    echo 0%%m
    )
for /l %%n in (10,1,31) do (
    if exist %%n\NUL ( 
    cd %%n
    d:\Renamer\ReNamer.exe /rename "telegraf-rename" "*"
    cd ..
    )
    echo %%n
    )
cd ..
)
echo %%l
)

This intended to be a script, which searches monthly directories, if they exist, enters them, then searches daily directories, if they exist, enters them and renames all internal files using a pattern. Renaming works perfectly, dir-travelling does not. Also, directory names, that are of single digit are named with a zero in a beginning, like 01, 02 etc, so i am going to treat them separately from 10-12 in months and 10-31 in days, because i am strictly limited to batch file, and i do not know how to check filenames using only batch file commands. This script generates errors while travelling down the directories. Please, point at my errors. THanks in advance. SORI FO MAI ENGRISH. IT BAD.

Upd: Modified code a bit, everything works fine.

That was a period of time in which "Why it's not working" turns into "Bah, im idiot"