Friday, September 25, 2020

Robocopy and a Weird Quirk in its Utilization

 As a professional (Oracle) database administrator, I'm obsessed with backups, including for my own personal computing. I have a strategy that includes backups across applications (e.g., a permanent email repository for my email client), multiple PC's/external drives/flash drives and multiple cloud storage vendors. Some might call me a digital packrat of sorts. But it does have its positive sides; I occasionally needed to pull up an old proof of payment, my updated Security+ certificate, a software utility I can no longer find online, etc. I have a collection of pdfs, certain video clips, political cartoons, embedded charts, etc. used in my signature political blog.

So frequently I have a cloud source directory including things like email files/folders, podcasts, etc. And usually I want to synchronize these files. Obviously I want to propagate the latest version of my resume and workfiles, emails, etc. On the other hand, once I've heard one of the podcast clips and delete it (I sometimes save a noteworthy episode, but that's the exception), I no longer need the old backup copy.

There are synchronization software products (I still have one or 2 installed on my workhorse PC), but occasionally I ran into usability issues (like the process getting hosed in the middle of a lengthy synchronization). I don't remember when exactly I learned about the Windows utility robocopy (certainly an improvement over my writing complicated XCOPY commands and the like), but I worked with some Windows administrators at work maybe 4 years back who heavily relied on it, and I've used it since then to some extent.

So suppose my C drive folder ccdrive is my source, and I want to synchronize it to my hard drive E. So I would enter a command like robocopy c:\ccdrive  e:\ccdrive /mir.

There is a complication to this strategy when you extend this process to flash drive. I have a large-capacity flash drive on which I've installed a large number of portable applications and various key backups in part designed to get a backup PC up to speed as quickly as possible in the event of a workhorse failure. Naturally, I want a backup of my flash drive, say F.

So I use a command like the one above to backup F: to e:\fdrive. Here's the counterintuitive thing: You can navigate to e:\fdrive just fine postcopy, but you may not see fdrive in Windows Explorer or other tools. You can fix this in two ways: (1) you can add  /A-:SH preventively to your flashdrive robocopy command, and/or (2) attrib -h -s -a  e:\fdrive. (You can find a related discussion here.)