Why does RoboCopy create a hidden system folder?
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.
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:\
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.