Link to home
Start Free TrialLog in
Avatar of tgarrity
tgarrityFlag for United States of America

asked on

Delay Copy in Batch File

Is there a way to create a bat file to copy over several files in intervals?
Meaning copy one file then wait 60 seconds and copy over the next file?

Thanks,
ASKER CERTIFIED SOLUTION
Avatar of Chris Nienaber
Chris Nienaber
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bill Prew
Bill Prew

I can't help but ask, since it could affect what solutions are recommended.  What problem or effect are you trying to accomplish by pausing in between file copies?  Is it true that you don't want to copy the same file over at different times, but different files that already exist in a folder?

~bp
Avatar of tgarrity

ASKER

The scenario:

I have a folder on Server A containing 500 .xml files and 15,000 .pdf files.
The .xml files contain info on where to file .pdf files on Server B.
I need to copy one .xml file at a time  to Server B every 120 seconds.
The .pdf files can be ignored, but wanted to make everyone aware as a copy *.* will not work in this case. I'm having to copy the .xml files one at a time due to a resource issue on Server B.
If I dump all 500 .xml files onto Server B, Server B will not process the .xml files and in turn will not correctly file the .pdf files.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Okay, to solve this issue, forget about delays etc... that's nonsense

Your code should consist of a single batch file which reads the information from each xml file one-at-a-time and then process pdf files accordingly.

From a top-level design viewpoint, the code (in pseudocode) shoulf look something like this:


FOR all XML files in the XML folder/s
   get the next XML file
   process it's data
   file PDF files accroding to data
END


It's as simple as that.

I'm busy right now writing code elsewhere however, when I am through with that I will return here to assist you further if in the meantime another expert has not already done so.
   
I ended up using the following script:

FOR /f "tokens=*" %%a in ('dir /b *.xml') do (
   copy "%%a" "Z:\"
   ping 1.1.1.1 -n 90
)

pause

Thanks for all the help!