58

So, I bought an SSD to upgrade the speed of my PC, and started transferring extranneous files over to a 10TB portable USB drive that I had. In this effort to reduce the size of my hard drive before trying to clone it to the SSD to make it bootable, I used the program SpaceSniffer to see if there's any other places on my hard drive that I could pull data from to reduce the size further, and to make my new SSD as "clean" as possible before the cloning.

Anyways, SpaceSniffer discovered the following folder:

Old HDD

Which is actually another "clone" of an even older terabyte hard drive that I'd upgraded from previously, and completely forgot about. Here's the thing though, I already have "Show Hidden Files and Folders" checked, and I'm able to see hidden files and folders. However, I am NOT able to see this folder for some reason: Hidden Files

The weird thing is, I CAN navigate directly to the folder and view its files by directly typing the path in the navigation bar: Old HDD Contents

Has anyone ever heard of this before, or can explain what's going on here? Also note the "read only" checkbox having a square in it, and the hidden checkbox being checked AND disabled in the very first screenshot above.

This seems to be a "super" hidden folder for some reason. And having used Windows since the 3.1 days, I've NEVER seen anything like this before. So, do any bigger Windows experts have any explanation for the strange behavior of this folder?

Braiam
  • 4,777

3 Answers3

83

In explorer, you can set "Show hidden files, folders, and drives", but there is another setting for "Hide protected operating system files (Recommended)". The latter one is usually enabled.

When a folder has the system and hidden flag set, it is configured as secured operating system file and remains hidden if show hidden files is turned on.

By typing attrib /d from a command prompt in the folder, you can see if this is the case.

See this example:

C:\>attrib /d
   SH                C:\$Recycle.Bin
     R               C:\Documents and Settings
A  SH   I            C:\hiberfil.sys
A  SH                C:\pagefile.sys
                     C:\PerfLogs
     R               C:\Program Files
     R               C:\Program Files (x86)
    H   I            C:\ProgramData
   SH   I            C:\Recovery
A  SH                C:\swapfile.sys
   SH                C:\System Volume Information
     R               C:\Users
                     C:\Windows

As you can see, the swapfile.sys, a system file has both +S and +H set, and thus it remains hidden unless you have the Hide protected operating system files (Recommended) unchecked in your settings.

The A stands for Archived, and the I for indexed. Type Attrib /? to get a full list of each letter.

In order to make the folder visible, you have to type Attrib -s -h "Old HDD"

Even though you can set the s and h individually, removing the s attribute also requires the h to be removed.

Also, explorer can set attributes on a file, but if you set it on a folder, the changes are usually ignored. With attrib, it just always works.

LPChip
  • 66,193
2

To add to the fix posted above, I found out both what's causing it in my case, and how to prevent it in the future.

After research, I found out that Robocopy has a bug where it alters the attributes of the directory to a system and hidden file. It's been known for quite some time and there are numerous blogs and questions out there on the subject. In order to reverse this change I had to alter the attribute so that the folder should no longer be marked as either a system or a hidden file. These attributes are altered in cmd using the parameters 's' and 'h' respectively

...

If you're clever and don't want to deal with the problem in the first place (as it's a known bug with Robocopy), when you write out your Robocopy line in cmd, include the minus attributes (/A-:SH) at the end of your command. This will stop the destination folder from being hidden and from being turned into a system file, thus preventing the problem ever happening in the first place:

e.g.

ROBOCOPY I:\DATA\ K:\DATA\ DB_DataFile.bak /A-:SH

Additional resource on SU as well.

EDIT: This seemed to work ok from CMD but does not from Powershell.

JVC
  • 432
0

Most likely you used robocopy to back up your old hard disk onto what is now your C:\ drive. For example

robocopy D:\ "E:\Old HDD" /e

The documentation linked above says:

If any data is copied from the root of a device, the destination directory will adopt the "hidden" attribute during the copy process.

The docs are in fact incorrect. If the source is the root of a drive, robocopy sets both the H (hidden) and S (system) attributes on any directories copied to the destination.

This can be verified in a command prompt by running attrib with the /d flag on your new C:\ drive. You will see something like this:

C:\> attrib /d
   SH                C:\$RECYCLE.BIN
   SH                C:\Old HDD
   SH                C:\System Volume Information

You can unset the attributes by running

C:\> attrib -h -s "Old HDD"
Hugh W
  • 146