11

I thought I would try out RoboCopy for mirroring the contents of a folder to another harddrive. And seems like it worked. But, for some reason, to see the destination folder I have to both enable Show hidden files, folders and drives and disable Hide protected operating system files. Why is this? Both the source and destination folder was initially both visible and normal directories. When I open up the properties for that destination folder, the Hidden attribute is even disabled. What is going on here?

Is it because I ran it in an administrator command prompt? Or is it an issue with my choice of modifiers? Or does robocopy really just work this way?

robocopy E: I:\E /COPYALL /E /R:0 /MIR /B /ETA

Update: Tried to copy another drive to another folder, and I got the same thing happening there. But when I try to just copy a folder to a different folder, then the destination folder stays normal. Could it be because I copy a drive? If so, how can I prevent this from happening? Cause I really do want to copy the whole drive...

Svish
  • 6,627
  • 14
  • 37
  • 45
  • Creating the directory ahead of time does not work. As soon as your run the robo copy again, the attributes once again make it hidden. The attribute command does work. –  Feb 25 '15 at 21:30

4 Answers4

9

On my system (Vista), powershell shows the c:\ drive as having both hidden and system attributes set.

    PS C:\Users\michael.DOMAIN> Get-Item c:\


    Directory:


Mode           LastWriteTime       Length Name
----           -------------       ------ ----
d--hs     8/18/2009 12:19 PM        <DIR> C:\

After copying the files, you can use attrib to fix them. Check out attrib /? for details.

M Aguilar
  • 879
  • 5
  • 5
  • Hm, yeah, all my three hard drives have those attributes as well... Weird thing is that my D and E drives got a hidden system folder when I robocopied them to folders on an external drive, while the C drive didn't O.o I don't get this... – Svish Aug 18 '09 at 18:02
  • I'm having the same problem with a hidden network share (`$`). I ran `Get-Item` on that share and it also says `d--hs` so I guess that's the reason! Thanks! – Chris Haas Jan 04 '12 at 15:58
  • This can also be true of network shares in general, such as from our Synology NAS box, that marks \\nas\sharename as a hidden folder. When you copy that folder with robocopy with the /copyall or /COPY:xAxxxx that includes (A)ttributes the destination folder is created with the same attributes as the source. – BeowulfNode42 May 12 '14 at 00:12
9

It has to do with copying the hidden/system System Volume Information from the root of a disk - if it gets copied, the target directory gets the same attributes system/hidden.

Creating the directory before copying does not help as robocopy will hide it too.

Add the /A-:SH switch to ignore system files.

More information in this Microsoft Technet discussion.

Belmin Fernandez
  • 10,629
  • 26
  • 84
  • 145
xcxc
  • 383
  • 3
  • 8
7

I have also ran into this problem. It seems like this hidden folder comes up when the source directory is a root of the drive, eg. D:\ or F:\. These folders will contain the system and hidden attributes, and being a source root folder, it can't be removed by the attrib -s -h command.

In this example, F:\ is the source G:\ is the destination.

You can see the attributes in PowerShell. You'll see the mode d--hs for directory, hidden & system. Try the get-item command C:\> Get-Item F:\

Robocopy supposedly will not create it as a hidden folder if the folder exists. I've read on a few posts that using a /CREATE will do the trick, or you can create the folders manually ahead of time. I have to do further testing as well as other combinations to verify this fully.

Otherwise, you can do a attrib -h -s G:\Destination_Folder to remove the system and hidden attribute after the copy.

HopelessN00b
  • 53,385
  • 32
  • 133
  • 208
JP Babiera
  • 71
  • 1
  • 2
0

Use M Aguilar's solution if you don't mind running attrib afterwards. Another solution would be to just create the target directory beforehand:

  1. mkdir I:\E
  2. robocopy E: I:\E /COPYALL /E /R:0 /MIR /B /ETA
jofafrazze
  • 117
  • 1