I was given a task to backup some data from some Windows computers to a local NAS drive. There are many options out there, but I remembered I many years ago I used a tool called Robocopy. As usual, Windows eventually bought this company and now Robocopy is part of Windows command tools.
Open your command prompt in Windows and type robocopy just to verify. You should see a brief output telling you about robocopy.

Now that you made sure robocopy is available in your Windows computer we can put this little script together maybe with a great cup of coffee on your desk. I will go directly to it:
@echo off
robocopy C:\Users\%username%\Desktop\ \\hqnas01\home\migrated_data\Desktop /MIR /XA:H /R:1 /XA:SH /FFT /XJ > C:\temp\%username%_migration.log
Explanation:
Parameter | Description |
C:\Users\%username%\Desktop\ | Source directory. |
\\hqnas01\home\migrated_data\Desktop | Destination directory. |
/MIR | Make a mirror backup. If you delete something from the source, it will also be deleted in the destination. |
/XA:H | Leave out hidden files. |
/R:1 | The number of retries if the file is locked. |
/XA:SH | Leave out hidden files and system files. |
/FFT | This is very important when backing up to a Linux NAS. If you leave this out it will try to copy files over and over even when they are already present. Just use it! |
/XJ | Exclude junction points. Those crazy hidden My Music, My Pictures and My Videos folders under Documents. |
> C:\temp\%username%_migration.log | For creating a .log file in order to see what happened. If you’re adding more than one line of backup locations you should add ‘>>’ instead of ‘>’ so you can append to the .log instead of replacing what you had before. |
Make sure you don’t confuse source with destination or you can have catastrophic lost of data. Contact me if you have any questions. Check out my shop with cool T-shirts and mugs designed by myself.