M
Michal Sankot
Heya,
I have problems using SET command, as it behaves rather strangely.
What it does, is that it doesn't assign value to a variable (which one
would axpect it to do).
My cmd script is:
-------------
set RESULTS_DIR=results
for /l %%G in (1,1,2) do (
for /f %%H in ('dir /b small_%%G.log*.*') do (
set FILE_TO_MOVE=%%H
:doMove
echo moving %FILE_TO_MOVE% ...
move %FILE_TO_MOVE% %RESULTS_DIR%
if not exist %RESULTS_DIR%\%FILE_TO_MOVE% (
sleep 1
goto doMove
)
)
)
-------------
It should move 2 logs small_#.log*.* to results folder and when some
of them isn't ready yet, it should wait 1 second and try it again.
Strangley enough "set FILE_TO_MOVE=%%H" doesn't assign anything to
FILE_TO_MOVE and it keeps cycling and printing out, it's moving the
file. Second "for" command does return name of log file, cause
otherwise it wouldn't get to printing out that it's doing it.
Is there some stragnge rule, that SET A=%%B doesn't work in for cycles
?
Michal
I have problems using SET command, as it behaves rather strangely.
What it does, is that it doesn't assign value to a variable (which one
would axpect it to do).
My cmd script is:
-------------
set RESULTS_DIR=results
for /l %%G in (1,1,2) do (
for /f %%H in ('dir /b small_%%G.log*.*') do (
set FILE_TO_MOVE=%%H
:doMove
echo moving %FILE_TO_MOVE% ...
move %FILE_TO_MOVE% %RESULTS_DIR%
if not exist %RESULTS_DIR%\%FILE_TO_MOVE% (
sleep 1
goto doMove
)
)
)
-------------
It should move 2 logs small_#.log*.* to results folder and when some
of them isn't ready yet, it should wait 1 second and try it again.
Strangley enough "set FILE_TO_MOVE=%%H" doesn't assign anything to
FILE_TO_MOVE and it keeps cycling and printing out, it's moving the
file. Second "for" command does return name of log file, cause
otherwise it wouldn't get to printing out that it's doing it.
Is there some stragnge rule, that SET A=%%B doesn't work in for cycles
?
Michal