Need a backup batch file

I have USB flash drive.

I get to work in the morning and copy all the data from the USB to the Work PC.  At the end of the day, I copy the entire folder from the Work PC back to the USB.

I take the USB home and make updates, change files, write to the USB directly.  Bring it back tomorrow and repeat the whole process.

Problem is my USB is getting full and it takes along time to copy back and forth all the files between the USB and Work PC.  I only want to copy the files that have changed each time.

Assuming on the Work PC the files are at C:\Folder and the USB is F: please provide a script and/or batch file that will solve my problem without causing data loss.
Who is Participating?
You only need the lines described above in a single batch file. The /d variable will only copy over files that have the newest time stamp. The batch file would accidentally overwrite the new data. If your path's have spaces in them, be sure to use quotations like below. Finally, a single asterick * only needs to be entered after the source path.
xcopy "source\*" "destination" /your variables.
xcopy "f:\folder\*" "c:\folder\" /d /e /q /y
xcopy "c:\folder\*" "f:\folder\" /d /e /q /y
I think you can use the XCOPY command to accomplish this.  Just put the text below into a batch file like USBCopy.bat to copy from your C:\Folder tot eh USB drive.  It will copy only newer files than what is on the destination.

XCOPY C:\FOLDER\*.* F:\ /D /E /Q /Y

pcarlowAuthor Commented:
I'll actually need 2 scripts, one to copy the changes from the night before off the USB and then another to copy the changes from that day back to the USB.  And I need it to work for sure, because this is very important data to me.

The other direction would be:

XCOPY F:\ C:\FOLDER\*.* /D /E /Q /Y

Test it first.  Put a current copy of all your files in a temporary folder and test it in both directions.  If something screws up you still have your backup in a temproary folder.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.