Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Need to create batch file with 10 sec interval between every 5 files transferred  (Read 4419 times)

0 Members and 1 Guest are viewing this topic.

zzahid

  • Guest
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!

marvinengland



    Hopeful

    Thanked: 11

    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>
    USA

    Salmon Trout

    • Guest
    I have to say, not a bad effort by marvin.