The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Copying files using batch files

I've written some extremely simple DOS batch files that copy files across the network and then perform actions against them. (Think move *.txt storage, type storage\*.txt, that sort of thing)

Trouble is, the network seems to be a bit flaky and the copies aren't completed before the next action is performed.

I've tried renaming the file, moving it to the target directory, then renaming it back prior to doing the actions, but that still occasionally misses some files.

Is there some DOS way of checking to see if a file has finished copying, or am I doing something fundamentally stupid? Or is a flaky network going to thwart whatever plans I make?
Batch programming is my limit
Friday, March 21, 2008
Look at robocopy - from the MS server tools package.
It is xcopy with optional retries/tiemouts - but it also has a restartable mode that will continue the copy from the same point when the network comes back.
Martin Send private email
Friday, March 21, 2008
Try the free version of Syncback:

Run it from the bat file, and follow up with your own commands.
B.K. Send private email
Saturday, March 22, 2008
Can you actually fall in love with a forum? I think I just did.

Thanks guys!
Batch programming is my limit
Sunday, March 23, 2008
> "Can you actually fall in love with a forum? I think I just did."

"We aim to please...and sometimes our aim is good."

I don't know wherethat quote came from (probably some dodgy re-enactor type I bumped into in my past) but it seems appropriate here. :)

Glad you found what you were looking for. I can second the recommendation for RoboCopy by the way - it's an awesome tool if you do any batch orientated file copying.
Anna-Jayne Metcalfe Send private email
Monday, March 24, 2008
If you use the /v option (verify) for the Copy or XCopy command it verifies that the destination file, once written, can be read.  That might get you what you need.

And you might want to check out Microsoft's PowerShell (seems they push it every .NET user group meeting I go to...)
Jim Brooks Send private email
Monday, March 24, 2008
Jim, good point - I'd been focusing on Move (which doesn't have a Verify option), maybe I'll Copy and Delete instead.
Batch programming is my limit
Tuesday, March 25, 2008

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz