Wednesday, 28 November 2018

E2B v1.A7f Beta available (and a bug found in robocopy!)

E2B v1.A7f Beta is here. The change is just in the new Backup .cmd script.

I failed to notice that the Backup_E2B_drive_to_MASTER.cmd backup script actually made a hidden folder on the Desktop instead of a normal, visible folder!

This was because I have 'view Hidden files' ticked in my Explorer options and so I didn't spot that the Desktop E2B_MASTER folder was actually changed to be a hidden folder by robocopy!

It turns out that there is a long-standing bug in robocopy!


If you copy the root folder of a drive which contains a folder which has the Hidden and System attributes, it makes the target top-level folder System and Hidden even though the hidden folder itself is not copied!

e.g.

Source:
K:\System Volume Information  (has System + Hidden attributes)
K:\(some files)

Target folder:
C:\temp\1\test

Command:
robocopy /mir K:/ C:\temp\1\test

Result:
C:\temp\1\test      folder is given Hidden + System attributes!
C:\temp\1\test\(some files)



The default action of robocopy is not to copy system folders but it should not have added System+Hidden attributes to the target folder!

Even if I add /xd "System Volume Information" it still shows the bug!

Using the switch  /A-:SH does work, but this causes all the files to have the Hidden attribute removed which is not what is wanted because we need to preserve the hidden attribute on some files.

Apparently this is a bug which MS have done nothing about for many years (since Vista\Win7?) - see here and here.

The only way to fix it was to use the attrib command after the robocopy command to ensure that the target folder does not have the System or Hidden attributes set.