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...
On my system (Vista), powershell shows the c:\ drive as having both hidden and system attributes set.
After copying the files, you can use attrib to fix them. Check out attrib /? for details.
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.
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:\
orF:\
. These folders will contain the system and hidden attributes, and being a source root folder, it can't be removed by theattrib -s -h
command.In this example,
F:\
is the sourceG:\
is the destination.You can see the attributes in PowerShell. You'll see the mode
d--hs
for directory, hidden & system. Try theget-item
commandC:\> 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.Use M Aguilar's solution if you don't mind running
attrib
afterwards. Another solution would be to just create the target directory beforehand:mkdir I:\E
robocopy E: I:\E /COPYALL /E /R:0 /MIR /B /ETA