Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a VM running XP on which files get uploaded at random moments. I need a script or utility fit for the command line, that would run every X minutes (for instance) and MOVE all uploaded files to a shared dir on a Win7 box.

Now, the command-line move command doesn't run across drives, even less so across shares. (And it gives the super helpful message Access denied.)

I could do a

copy src desr_share
rm src

...but here's the tricky part:

When the copy command runs, it may happen that a file is uploaded at the same time. The copy may upload just a chunk of the file, or skip it completely and move on, but later, when the rm kicks in, the file may be completely uploaded, and the rm will erase it, without it having been properly copied to the destination.

So I need something that has the move semantics (copy a file and delete it only if successful), but that would work across machines.

Any suggestions?

PS. I don't mind if a file gets only partially moved, as long as it's not then deleted. I will force overwriting any destination files, and on the next run, the file will be uploaded again, completely.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Look into Robocopy, which is standard on Win7 and is available in a microsoft dev kit for xp.

use robocopy /? (or robocopy /? > drive:\path\robocopy_options.txt) for options.

Windows 7:

http://technet.microsoft.com/en-us/library/cc733145%28v=ws.10%29.aspx

Windows XP:

http://www.microsoft.com/en-us/download/details.aspx?id=17657#Requirements

share|improve this answer
    
Nice. What I used is:> robocopy src dst /move /e –  Cristi Diaconescu May 29 '12 at 18:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.