Copy 20 files at a time

August 26, 2009 at 22:46:42
Specs: Windows 2003
I was trying to look at a method to copy (not move) 10 files from 1 directory to another to then wait 1 minute and then copy the next 10.It would do this for all files in the folder.

I had tried

for /f "tokens=*" %%D in ('dir/b/od *.xml') do set latest=%%D
xcopy "%latest%" C:\temp\files\folder2


I had tried this but this will always move the oldest file each time so even if I ran it 10 times it would always try and copy the same file.

I have to leave the original files in the first folder and copy the files not move them.


See More: Copy 20 files at a time

Report •


#1
August 27, 2009 at 00:48:09
Got this far but still tries to copy a single file over and over again.

@ECHO OFF

SET /a VAR=0
:HOME
SET /a VAR=VAR+1

IF %VAR%==21 goto :End

for /f "tokens=*" %%D in ('dir/AA/b/od *.xml') do set latest=%%D
xcopy "%latest%" C:\temp\files\folder1
attrib -a "%latest%"
goto :HOME

:END


Report •

#2
August 27, 2009 at 01:03:38

set latest=

else it will always try and copy the last file DOUH!


Report •

#3
August 27, 2009 at 01:16:12
Nice solution! When I first read your question, I was thinking about how I would solve it, before seeing your own replies. Which teaches me one thing: if you ignore a problem long enough, it goes away ;-)

Report •

Related Solutions

#4
August 27, 2009 at 15:13:25
Yer was a bit of a hard one, I did not know how to ignore or tell what files I had moved already then some one talked about "Archive" and then it clicked.

Clearing the SET command was the final bit in the puzzle, it kept trying to move a file that had been moved before. I could not tell and then it just clicked again.


Report •


Ask Question