File backup in Windows – Robocopy
In Linux, you probably use the amazing rsync to back up your resources.
When it comes to Windows, you may end up searching for various software programs, possibly open source, to decently do mirror/incremental backups, and you may be amazed by the crap that’s out there.
However, you don’t actually need to install anything. Windows seems to have a nice robocopy command that works similar to rsync.
Here’s an example:
robocopy C:\Users\name\Documents X:\backup\Documents /mt /mir
Well, good. But… this sounds too nice to be true, right? I mean, we are talking about Microsoft, we are talking about Windows… you sure there is no caveat?
Of course there is! If you happen to copy from the root folder of a device (partition or whatever), this bullshit of a program is going to make the destination folder invisible by applying the System and Hidden attributes even though no one asked for it.
Well, sure you can prevent that by not copying the attributes right?
/copy:DT
Of course not.
Well, explicitly remove them?
/a-:SH
No. Because the program is bugged.
So at the end of your batch file you need to throw a:
attrib -h -s -a "Dest"
Which means though, that while the process of copying is running, you won’t be able to see the destination folder, which is ridiculous.
There is no redemption. Windows is the worst operating system available to this date and since ever.