I'd like to create a batch file that moves X files from a directory to
another where x is a number;-)
I have a directory with 100000 files and i'd like my script to move 100
files to another dir each time the batch is run.
The goal is to schedule this process so the batch moves e.g. 100 files every
5 minutes untill the source dir is empty.
Any Idea?
Thanks all!
Partially tested (without moving files).
---begin script
@echo off
set SourceDir=C:\dir1
set TargetDir=C:\dir2
set MaxFiles=100
for /f "tokens=1* delims=[]" %%G in ('dir /A-D /B "%SourceDir%\*.*" ^|
find /v /n ""') do (
echo move "%SourceDir%\%%~nxH" "%TargetDir%\"
if %%G==%MaxFiles% exit /b 0)
---end script
Remove 'echo' in 'for' loop to activate the script.
Cheers,
Tomek
> Cheers,
>
> Tomek
Wow thank you!
I'm just tuning it and it's perfect
Tyrser
@echo off
for %%i in (SourceDir\*) do call:move %%i
goto:eof
:move
set /a ind+=1
if %ind% gtr 100 exit /b
move "%1" DestDir\