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'm using this command to copy a file on a daily basis.

COPY "E:\ClipData.txt" "Clipboard\ClipData.txt"

But is there anyway without making it complicated, to copy the file after the source file has been modified?

There are standalon softwares that manages to do that, but the application must be running al the time.

So the cmd solution is much better.

share|improve this question
    
Do you mean if there is a change or after there has been a change? Former is easy, latter needs the sw to be on all the time –  Karthik T Nov 27 '12 at 1:19
    
After there has been a change. Whats I have are the line inside a .bat file, and using task schdule in Windows XP to repeat it every day. –  Johan Larsson Nov 27 '12 at 1:25

3 Answers 3

If it is enough to check if the file has been changed before you copy it, replace copy with xcopy /D. It should now only copy the file if it has changed. If you put it in a batch file and run it every so often, it will only copy the file after it has changed

reference : http://www.computerhope.com/xcopyhlp.htm

share|improve this answer

There's the Archive bit that the system sets to 1 when the file has been changed. But to use it you'll need to remove this bit from all files at first, and then edit your script to remove this bit after coping a file.

share|improve this answer

There's robocopy: http://technet.microsoft.com/pt-br/library/cc733145(v=ws.10).aspx

http://social.technet.microsoft.com/wiki/contents/articles/1073.robocopy-and-a-few-examples.aspx

To mirror the directory "C:\directory" to "\server2\directory" excluding \server2\directory\dir2" from being deleted (since it isn't present in C:\directory) use the following command:

Robocopy "C:\Folder" "\Machine2\Folder" /MIR /XD \server2\ directory\dir2"

Robocopy can be setup as a simply Scheduled Task that runs daily, hourly, weekly etc. Note that Robocopy also contains a switch that will make Robocopy monitor the source for changes and invoke synchronization each time a configurable number of changes has been made. This may work in your scenario, but be aware that Robocopy will not just copy the changes, it will scan the complete directory structure just like a normal mirroring procedure. If there are a lot of files & directories, this may hamper performance.

share|improve this answer

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.