30

I've been happily using robocopy for backing up my computers to an external usb drive. It's great since it only copies the files that were changed/updated/new. I can take my external drive to any machine and look at it just as if it's another drive on the computer.

I've recently purchased a 750g and another 1tb external hard drives. I ran a robocopy over the weekend that copied about 500g to my external drive. After the copy My Computer shows that ~500g has been used on the external drive. The strange thing is that when I click on the drive in Windows Explorer, nothing shows up in the right pane of Windows Explorer (and the + goes away in the left pane). I copied a single file (drag-and-drop) to this drive and it shows up in Windows Explorer. Command Prompt show the same thing. 1 file.

I know the files are on the drive as it shows up as the Free Space has been reduced.

I read that I should make sure simple file sharing is off, which it is. I also took ownership of the files as Administrator. Still nothing. It works the same on my WIndows XP machine and my Windows 7 Ultimate.

Has anyone else seen this? Or even better, does anyone know what I am doing wrong or how to solve this problem?

thanks! Bill44077

SherylHohman
  • 16,580
  • 17
  • 88
  • 94
Bill Campbell
  • 2,413
  • 6
  • 27
  • 32
  • That is some weird behavior of robocopy… Is there any justification for assigning system attribute? Also, has it been rectified in Win 8, 8.1 & 10? – Viral Jain Feb 05 '15 at 07:15
  • 1
    I just had this happen on Windows 10. I issued the command `robocopy "D:" "H:\Backup" /MIR`, where the H:\Backup directory did not exist prior to running the command, and robocopy created the directory as an invisible system directory. I don't see a command-line option to alter that behavior, so I guess it's best to create the root destination directory manually prior to running robocopy. – Mark McClelland Mar 22 '16 at 17:42
  • How did you use robocopy exactly? What was your command? – Shayan Nov 04 '19 at 16:01
  • 1
    @MarkMcClelland I just hit the same issue in Win10, but in my case I had already created the root destination dir in explorer before running Robocopy. So I don't think this is a solution :-( – Jimadine Nov 05 '19 at 18:03
  • You're right, @Jimadine. As SherylHohman explains in an answer below, it's more likely that the hidden attribute is being copied from the source directory and applied to the target dir. – Mark McClelland Nov 05 '19 at 22:17

5 Answers5

45

In my case, the above didn't work.

This worked instead: attrib -h -s -a [ Drive : ][ Path ].

For example: attrib -h -s -a "C:\My hidden folder".

Ricky
  • 7,785
  • 2
  • 34
  • 46
35

When copying from the root directory of a drive to a folder (non-root directory on a different drive), this can happen.
RoboCopy may set the new directory to hidden, as it copies the system attribute of the root folder of the drive over to the new folder.

You can prevent the new directory from becoming hidden by adding the /A-:SH option/flag/switch to your robocopy command.
See this Server Fault Answer to "Why does RoboCopy create a hidden system folder? " for more information.
However, this may or may not prevent copying system attributes in other folders, according to this discussion on the Microsoft forum "ROBOCOPY hides destination Directory".

Here is an example taken from my longer, more thorough, Answer on Super User to the Question "How to preserve file attributes when one copies files in Windows?":
Robocopy D:\ C:\D_backup /A-:SH /DCOPY:T /COPYALL /E /R:0 /ZB /ETA /TEE /V /FP /XD D:\$RECYCLE.BIN /XD "D:\System Volume Information" /LOG:C:\D_backup_robocopy.LOG /MIR

However, if you already copied the directory without the /A-:SH option, running the command mentioned by Ricky above (attrib -h -s -a [ Drive : ][ Path ]) will fix the issue by unhiding the directory. Though, I found that -a was not needed.
So in my case, for the example above, attrib -h -s C:\D_backup (without the -a option) made D_backup visible.

SherylHohman
  • 16,580
  • 17
  • 88
  • 94
8

Just ran into this issue myself, so it may be a late response and you may have worked it out already, but for those stumbling on this page here's my solution...

The problem is that for whatever reason, Robocopy has marked the directory with the System Attribute of hidden, making it invisible in the directory structure, unless you enable the viewing of system files.

The easiest way to resolve this is through the command line.

  • Open a command prompt and change the focus to the drive in question (e.g. x:)
  • Then use the command dir /A:S to display all directories with the System attribute set.
  • Locate your directory name and then enter the command ATTRIB -R -S x:\MyBackup /S /D where x:\ is the drive letter and MyBackup is your directory name.
    The /S re-curses subfolders and /D processes folders as well.

This should clear the Read Only and System attributes on all directories and files, allowing you to view the directory normally.

SherylHohman
  • 16,580
  • 17
  • 88
  • 94
Ben01635
  • 160
  • 1
  • 3
  • 5
    Doing this I got in spanish `El archivo oculto no se restablece: ` (comes to say, that _hidden file has not been restored_). Answer by [Ricky](https://stackoverflow.com/a/13331759/1099452) worked instead. – lucasvc Feb 26 '19 at 08:39
0

In addition to the great answers SherylHohman and Ricky left I wanted to add that merely adding the /A-:SH switch for robocopy did not work and the copy created a hidden, system folder on the destination drive.

However, using the /A-:SHA parameter did work and my top level destination directory was not given the system or hidden attributes. Weirdly, my drive does not have the "a" (archived) attribute set so I am dumbfounded as to why this works at all. I do prefer simply removing these attributes to only the root destination folder after completion of the robocopy command per Ricky's suggestion so that these attributes are respected for any sub-directories. Though the /A- switch is easier to manage and (for my backup purposes) are not relevant to any directories I am backing up. You may want to consider not removing the system or hidden attributes if you're backing up your C:\ drive though.

Pastrami1
  • 44
  • 3
-1

You could try this, I say could, because the whole Windows 10 has annoying flaws everywhere, I have lost trust to Windows 10 and Microsoft.

Well I found that after I robocopied the whole Documents-folder to a root of external drive, I got a folder that is not named Documents but the Documents-folder is renamed&translated to my native language, so it could be some Language issue. (the /XD option tells robocopy to skip a folder)

C:\users\asdf\documents >robocopy . f:\ManuBackup /XD c:\Users\Asdf\Documents\OneDrive /s

File Explorer shows Tiedostot-name (=Documents in finnish) and Command Prompt shows ManuBackup-name. Also I have tried all attrib.exe commands to the ManuBackup-folder, don't trust me 100%

re Paul
  • 122
  • 1
  • 8