|
Answer» I need to check 10 different Source directories for files and move them to 10 different DESTINATION directories. However files over 50Mb I need to move to a BigFile directory and rename the EXTENSION to *.big. I'm new/rusty to batch files but I've created the following script that I can't SEEM to get working correctly. I'm using it in a windows environment.
echo on
setlocal
set /p directory1=D:\receivingdir\2.16.840.1.113883.3.105.102
set /a size=52428800
set /p newdirectory1=D:\processingdir\Sources\2.16.840.1.113883.3.105.102\In
set /p newdirectory2=D:\BigFileTransport
for %%q in %directory1% do if %%~zq lss %size% move %%q %newdirectory1%
for %%q in %directory1% do if %%~zq geq %size% move %%q %newdirectory2%
pause
Any ideas?Lose the /p switch from SET. For details of usage of SET command, type SET /? at the prompt.
If any filenames are likely to have spaces you should use quotes
e.g.
Code: [Select]move "%%q" %newdirectory1% FOR syntax needs correction
Code: [Select]for /f "delims=" %%q in ( ' dir /b /a-d "%directory1%\*.*" ' ) do if %%~zq lss %size% move "%%q" %newdirectory1%
THANKS Salmon!
|