1.

Solve : Need to create batch file with 10 sec interval between every 5 files transferred?

Answer»

I need to create a batch file that copies multiple files (huge # of files) from my xp desktop to a windows 2003 server.
I need to copy 5 files at a time and then take a 10 seconds break in between until all the files are copied.

xcopy a:\file_1 \\10.0.0.5\C$
(from) (to)
Any help would be appreciated.

Thanks!Quote from: zzahid on June 09, 2010, 02:08:20 PM


xcopy a:\file_1 \\10.0.0.5\C$
(from) (to)
Any help would be appreciated.

Thanks!

This is rough idea what is needed. A COUNTER and sleep command.


C:\test>type zz.bat
Code: [Select]@Echo off
setlocal enabledelayedexpansion
set /a CNT=0
for /f "delims=" %%i in ('dir /s /b c:\*.txt') do (
set /a cnt=!cnt! + 1
echo cnt=!cnt!
if !cnt! EQU 10 sleep 10
if !cnt! EQU 12 goto end
xcopy /s %%i c:\zz\
)

:end
Output:

C:\test>zz.bat
cnt=1
cnt=3
C:\06-07-2010\a1.txt
1 File(s) copied
cnt=4
C:\06-07-2010\a2.txt
1 File(s) copied
cnt=5
C:\06-07-2010\a3.txt
1 File(s) copied
cnt=6
C:\06-07-2010\a4.txt
1 File(s) copied
cnt=7
C:\06-07-2010\a5.txt
1 File(s) copied
cnt=8
C:\06-07-2010\abc.txt
C:\06-07-2010\archive\abc.txt
C:\06-07-2010\Backup\15\abc.txt
C:\06-07-2010\Backup\17\abc.txt
C:\06-07-2010\Backup\18\abc.txt
C:\06-07-2010\savhere\abc.txt
6 File(s) copied
cnt=9
C:\06-07-2010\abc2.txt

C:\06-07-2010\archive\abc2.txt
C:\06-07-2010\Backup\15\abc2.txt
C:\06-07-2010\Backup\17\abc2.txt
C:\06-07-2010\Backup\18\abc2.txt
C:\06-07-2010\savhere\abc2.txt
6 File(s) copied
cnt=10
C:\06-07-2010\abc5.txt
C:\06-07-2010\Backup\17\abc5.txt
C:\06-07-2010\Backup\18\abc5.txt
3 File(s) copied
cnt=11
C:\06-07-2010\arc.txt
1 File(s) copied
cnt=12

C:\test>I have to SAY, not a bad effort by marvin.


Discussion

No Comment Found