Urgent - Copy Batch of 10 files to dst folder every 5 min

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
venred
Posts: 4
Joined: 18 Mar 2010 02:10

Urgent - Copy Batch of 10 files to dst folder every 5 min

#1 Post by venred » 18 Mar 2010 02:27

Hi All,

It would be great help if any one will provide the BAT solution.

We have a requirement to create clones of .tif images and created batch folders which contains 10 images and each batch will be copied to the destination drive (z:\) for every 5 minutes.

Ex:

Source folder: Destination Drive
C:\Batch1 (10 .tiff images) Z:\
C:\Batch2 (10 .tiff images) Z:\
C:\Batch3 (10 .tiff images) Z:\
. Z:\
. .
.
etc..

After every 5 minutes each batch(10 images) will be copied into destination folder z:\ drive.

Thanks in advance.

Regards,
Venred

venred
Posts: 4
Joined: 18 Mar 2010 02:10

Re: Urgent - Copy Batch of 10 files to dst folder every 5 mi

#2 Post by venred » 19 Mar 2010 03:45

It would be really helpfull for me, if anyone will through light on this please.

avery_larry
Expert
Posts: 391
Joined: 19 Mar 2009 08:47
Location: Iowa

Re: Urgent - Copy Batch of 10 files to dst folder every 5 mi

#3 Post by avery_larry » 19 Mar 2010 15:54

Something like this?

*untested*

Code: Select all

@echo off
cd /d c:\

:loop
cls
echo Copying files from batch* folders to z:\
for /d %%a in (batch*) do copy "%%a\*.*" z:\
::wait 5 minutes
echo Wait 5 minutes
ping -n 300 -w 999 127.0.0.1 >nul 2>nul
goto :loop

venred
Posts: 4
Joined: 18 Mar 2010 02:10

Re: Urgent - Copy Batch of 10 files to dst folder every 5 mi

#4 Post by venred » 24 Mar 2010 08:38

HI Larry,

Thanks you very much for the reply.

Could you please provide enhanced code as it is copying all the files repeately every 5 minutes?

For ex: Each batch contains 10 files, Batch 1, Batch 2, Batch 3. All 30 files are copying every five minutes.

Here the requirement is after every 5 minutes one batch will be copied to the destination folder z:\

Could you please through some light?

Thanks in advance.

Regards,
Venred

avery_larry
Expert
Posts: 391
Joined: 19 Mar 2009 08:47
Location: Iowa

Re: Urgent - Copy Batch of 10 files to dst folder every 5 mi

#5 Post by avery_larry » 26 Mar 2010 09:46

You mean you want one of the batches copied each 5 minutes, and then looped?


Try this:

Code: Select all

@echo off
cd /d c:\

:loop
cls
echo Copying files from batch* folders to z:\
for /d %%a in (batch*) do (
   time /t
   echo Copying %%a now . . .
   copy "%%a\*.*" z:\
   time /t
   echo Wait 5 minutes
   ping -n 300 -w 999 127.0.0.1 >nul 2>nul
)
goto :loop

venred
Posts: 4
Joined: 18 Mar 2010 02:10

Re: Urgent - Copy Batch of 10 files to dst folder every 5 mi

#6 Post by venred » 29 Mar 2010 03:57

Hi Larry,

Millions of thanks for this. :D

Regards,
Venred

Post Reply