locked
ROBOCOPY hides destination Directory

    Question

  • I have used ROBOCOPY to tranfer a large file from or to a USB drive and the destination Directory on both occassions has beeen chnaged to a hidden system directoiry, which could not be seen in Windows explorer or through command line access, even with the "Show hidden and System files" set on in the view properties window.

    The command executed was ROBOCOPY {source drive} {destination drive\folder} /MIR

    The command echoed all the actions performed during the copy and displayed a successful copy command summary at the end.

    To enable windows to see the directory I had  to either type the directory in the explorer address bar, or use the command prompt to change the attribute of the directory as follows "attrib -h -s d:\Films", whereupon the directory was visible in windows explorer. 

    Can anyone suggest a way out if this wwithout the need to execute the attribb -h -s command after every ROBOCOPY command?

    Thursday, August 12, 2010 10:55 AM

Answers

  • Try Attribute /A-:SH instead of  A:-SH

    That worked for me.

    robocopy \\S09\S09_D\ "C:\Dropbox\S09_D" /mir /R:0 /W:0 /FFT /A-:SH

    The /FFT option with 2-second date/time granularity is useful when copying to devices with other file system than NTFS (QNAP) 

    See also http://ss64.com/nt/robocopy.html

    Best regards

    Sigurd

    Thursday, April 12, 2012 3:03 PM

All replies

  • Hi,

     

    Thanks for posting in Microsoft TechNet forums.

     

    I just performed a test using above command without any problem. I am assuming it is due to the USB drive itself, it may be infected by viruses or malware. Regarding this, I would like to provide the following suggestions:

     

    1.     Use ROBOCOPY to copy files to the built-in hard drive to see if the issue occurs.

    2.     Manually copy the files to the external USB drive to see if they are hidden.

    3.     Update the security software and perform a full scan.

    4.     Format the USB drive to remove suspicious files completely and perform ROBOCOPY again.

     

    Best Regards

    Dale Qiao
    TechNet Subscriber Support
    in forum. If you have any feedback on our support, please contact tngfb@microsoft.com


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
    Monday, August 16, 2010 2:42 AM
    Moderator
  • Hi,

    As this thread has been quiet for a while, we assume that the issue has been resolved. At this time, we will mark it as ‘Answered’ as the previous steps should be helpful for many similar scenarios. If the issue still persists, please feel free to  reply this post directly so we will be notified to follow it up. You can also choose to unmark the answer as you wish.
    BTW,  we’d love to hear your feedback about the solution. By sharing your experience you can help other community members facing similar problems. Thanks for your understanding and efforts.

    Best Regards

    Dale Qiao
    TechNet Subscriber Support
    in forum. If you have any feedback on our support, please contact tngfb@microsoft.com


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
    Wednesday, August 18, 2010 1:28 AM
    Moderator
  • Hello,

    I am seeing this phenomenon also on Windows Server 2008 R2 X64

    Here is the command i am running:

    robocopy \\10.85.58.130\d$ \\MRDC01\APPS_Backup\XV /S /E /FP /XD temp  RECYCLER sereno "System Volume Information"   /XF pagefile.sys

    The destination folder XV is having the attributes set ad Archive, Hidden, System

    May it be because the source is an administrative share?

    Thanks,
    Norbert
    Friday, August 27, 2010 3:02 PM
  • Hi there,

    I too am seeing this behavior, where the source file is normal, but Robocopy changes it to "system" "hidden" on the target drive.  I am copying several folders from my C: drive to my E: drive.  They are both internal hard drives.  All of the folders copy normally, excepting one, the "My Documents" folder.  It is the one that gets its attributes changed.  All the commands in my batch file are identical.  Here is the command that copies the "My Documents" folder, that is for some mysterious non-obvious reason changing the attributes.  By the way, the destination folder (E:\Shuksan\My Documents) already exists each time. I am just "updating" it with changed files.

    robocopy "C:\Users\Roger\My Documents" "E:\Shuksan\My Documents"  /NP /S /E /V /XO /XJ /LOG:"C:\Users\Roger\Scripts\E_Shuksan.log" /R:0 /W:5

    The "E:\Shuksan\My Documents" folder gets changed to "system" "hidden" every time. I change it back with the "attrib" command, but why is this happening?  It doesn't seem right!

    By the way, I'm running Windows 7, 32 bit edition , which has "robocopy" built in.  I have two hard drives, C and E (why "E" instead of "D" I don't know), the C: drive is 300GB and the E drive, mostly empty, is 1 terabyte.

    **** UPDATE NOTE******

    I just found a solution, though I hate it.  I added the switch /A:-SH to the command, and now the directories copy and are not converted to "System" "Hidden". The new command looks like this:

    robocopy "C:\Users\Roger\My Documents" "E:\Shuksan\My Documents"  /NP /S /E /V /XO /XJ  /A:-SH   /LOG:"C:\Users\Roger\Scripts\E_Shuksan.log" /R:0 /W:5

    Thanks

    Roger Matthews

    • Proposed as answer by supermop Friday, December 14, 2012 10:36 AM
    Saturday, October 30, 2010 6:35 AM
  • I'm also seeing the same thing, however, I have something else to add. I have several robocopy commands which I execute from a scheduled .bat file. I'm copying several directories, such as "C:\Data", "C:\Distributions" as well as "C:\Users\mark.FIRSTMOUNTAIN.000\My Documents". The first two correctly copy without being hidden or system at the destination. Only the My Documents directory behaves as described above.

    I also have another wrinkle which I observed. Originally, I was copying C:\Users (in other words, I wanted to back up all the user directories). I found that robocopy got into some kind of endless loop, where it kept copying the same directories with ever lengthening directory names. It seemed to keep concatenating ApplicationData as in ApplicationData\ApplicationData\ApplicationData...etc. I think it had to do with "All Users" which must be a pointer to the other sub-directories.

    I agree with Roger that the /A:-SH solution is not pretty. What if there are legitimate S or H files in the directory you're copying? It should copy the attributes of the files without changing them.

    Thanks,

    Mark Hartigan

    Wednesday, December 8, 2010 7:53 PM
  • I had all the same frustration, I just can't get used to all the "Features" of Windows 7.

    I tried using all the back-up utilities and they are worthless, I like all my files on a external drive so I can get them from any pc any operating system, and I always relied on robocopy scripts, they work great.

    But I still can't get it to work with the my pictures my music directories, I tried the A:-SH and it doesn't recognize it.

    What a royal pain in the neck.

    Thursday, December 30, 2010 2:52 AM
  • Same Problem when copying from the root of the drive (ie d:) to a subdirectory on another drive (ie z:\backup_d)

    Have to use attrib -s -a -h d:\backup_d to unhide the folder.

    Tried many robocopy options without success

    Any clue ?

    Thanks

    Patrick

    Monday, March 5, 2012 6:29 PM
  • I've had this problem forever on Win7 (64 bit). It's been two years now. Why hasn't Microsoft fixed this yet?
    Thursday, March 15, 2012 4:41 PM
  • Try Attribute /A-:SH instead of  A:-SH

    That worked for me.

    robocopy \\S09\S09_D\ "C:\Dropbox\S09_D" /mir /R:0 /W:0 /FFT /A-:SH

    The /FFT option with 2-second date/time granularity is useful when copying to devices with other file system than NTFS (QNAP) 

    See also http://ss64.com/nt/robocopy.html

    Best regards

    Sigurd

    Thursday, April 12, 2012 3:03 PM
  • Had the same problem, /A-:SH solves it. :-)

    Jens H H

    Wednesday, October 31, 2012 9:18 PM
  • I'm having the same problem..../A-:SH does not solve it for me.  I'm still having to do what the original poster does change the directory attribute by running run a "attrib -h -s d:\directoryname" on the directory.    Any other ideas?  
    Thursday, February 21, 2013 9:40 PM
  • hello Everyone : /A-:SH  works for me ! i'm using a windows 7 x32 bit machine ..
    Tuesday, June 25, 2013 6:07 PM
  • bingo!!! this is the correct syntax!!
    Thursday, August 8, 2013 9:43 PM
  • The post originally marked as the answer is not the answer.  It gets frustrating coming across all these dead ends on Technet Social; just because the original poster didn't follow up fast enough does not mean the first suggestion (usually something like "you probably have a virus") is the right answer.

    I can also state that on a regular (but inconsistent) basis, I have seen robocopy set the root destination directory with the hidden and system attributes while in the process of copying.  A typical script template I use for grabbing everything except the OS is "robocopy "D:\test\src dir\\" "E:\test\dest dir\\" /E /ZB /COPY:DATSOU /DCOPY:T /MT:2 /XF "pagefile.sys" "hiberfil.sys" /XD "$RECYCLE.BIN" "RECYCLER" "System Volume Information" "Temporary Internet Files" "D:\Windows" "D:\WINNT" /XO /XJ /R:2 /W:1 /LOG:"%userprofile%\Desktop\rcopy.log" /X /V /FP /NP /TEE".  I usually have to follow it up with "attrib -h -r -s "E:\test\dest dir" as "dest dir" is often (but not always) set with hidden and system.  This is seen on system freshly installed from Microsoft genuine discs where the system in question has never seen the internet.

    My problem is that it is significantly easier to add an extra line to a batch file than worry about why this particular utility has this particular behavior in certain (unknown to me) circumstances.

    -wph

    Edit: Two more search links down shows me what I hadn't bothered to notice before.  This appears to happen with robocopy when the source is a root diretory.  Found at http://serverfault.com/questions/55668/why-does-robocopy-create-a-hidden-system-folder.

    • Proposed as answer by Prospect PC Wednesday, October 9, 2013 3:47 AM
    • Unproposed as answer by Prospect PC Wednesday, October 9, 2013 3:47 AM
    • Proposed as answer by Prospect PC Wednesday, October 9, 2013 3:49 AM
    • Edited by Prospect PC Wednesday, October 9, 2013 3:54 AM Clean up sloppy grammar and punctuation.
    Wednesday, October 9, 2013 3:45 AM
  • this happens when trying to copy from a root to a folder and can be fixed 
    by using one of the following methods
    place /A-:SHA at the end of the string 
    Like below

    robocopy A:\ B:\BackupA\ /E /COPYALL /XO /IT /R:1 /W:1 /ZB /A-:SHA

    or add This after the above where B is the drive letter and BackupA is the destination  folder

    attrib -h -s -a B:\BackupA\
    • Edited by JumbleWeed Monday, November 4, 2013 9:12 PM
    Monday, November 4, 2013 9:12 PM
  • It is because you are copying the system folder "System Volume Information" from the source. If that folder is copied into a sub-folder the sub-folder becomes a system folder. Use the switch above or exclude the System Volume Information folder when you copy.
    • Proposed as answer by iJamesA Thursday, December 12, 2013 12:20 PM
    Thursday, December 12, 2013 12:19 PM
  • I am experiencing the same issue in Windows 8 x32.

    Using the command:

    robocopy "E:\\" "F:\Backup_Manually\Incremental RC Backup\\" /e /r:0 /log+:"F:\Backup_Manually\Logs\Incremental RC Backup log.txt"

    Saturday, January 11, 2014 11:33 PM
  • It seem to be quite tricky this.

    Even entering the A-:SHA in my string, I was not able to find the documents or folders.

    Ended up with copy the location where the files has been copied to (form the log-file) and pasted it into Windows Explorer.

    Then all my folder and files are visible.

    Don't ask me why, but it worked.

    Rgds

    Dag N

    Thursday, March 13, 2014 12:02 PM
  • Hi,

    As this thread has been quiet for a while, we assume that the issue has been resolved.


    You know what happens when you assume, don't you?
    Thursday, April 17, 2014 6:51 AM
  • this is incorrect as it's nothing to do with a usb drive
    Wednesday, March 18, 2015 8:08 AM
  • Thanks much.
    Sunday, March 29, 2015 6:35 PM
  • Try Attribute /A-:SH instead of  A:-SH

    That worked for me.

    robocopy \\S09\S09_D\ "C:\Dropbox\S09_D" /mir /R:0 /W:0 /FFT /A-:SH

    The /FFT option with 2-second date/time granularity is useful when copying to devices with other file system than NTFS (QNAP) 

    See also http://ss64.com/nt/robocopy.html

    Best regards

    Sigurd


    Just solved my issue as well. How come an utility like robocopy which is used so much by so many people has these kinds of bugs? honestly, this is such a bad mistake by microsoft..
    Monday, May 18, 2015 8:45 AM
  • I also had this problem and tried the /A-:SH but it refused to remove the System and Hidden flags.  Curiously, it turned out to be because I was putting the log file into the destination folder!  As soon as I moved the log file to another location, it worked fine.
    Thursday, June 18, 2015 8:13 AM
  • Hello, I had the same problem
    I resolved, with the command "/xd RfsrPrivate". This folder doubled my backup.

    Monday, August 3, 2015 6:55 PM
  • /A-:SH works for me, OS Win7 Ultimate 64 bits. Thanks !!
    Friday, November 20, 2015 2:26 PM
  • This happens for me, too, and I really doubt it to be a virus. I had this happen under various situations but the easiest to reproduce is when I copied from E:\ to "D:\Backups\Drive #3" using /MIR /W:1 /R:1 where E:\ was an external USB drive formatted as NTFS and D:\ was an internal drive formatted with ReFS on a Windows Server 2012 R2 box. (D:\ was part of a storage pool.)

    The even worse issue was when I copied from my Windows 10 machine to the server. I copied from E:\Subfolder (E:\ was an external NTFS USB drive attached to the Windows 10 machine) to "B:\Drive #4" (where B:\ mapped to the Backups folder on the server). Note that the source is **not** the root. When I attempted this it would keep failing as it tried to change the attributes on the destination folder (i.e., "Drive #4") but didn't have permission to do so. I fixed the permission issue, but the issue should never have existed in the first place as robocopy should **not** change the attribute of the destination folder!!!

    An additional issue that came from copying from my Windows 10 machine to my server was that all that it copied was directories, no files! There was no reason for this as I was doing a simple /MIR /W:1 /R:1.


    P.S. How can you have permission to mark your own answer as "answered"? That is just wrong. Only the person that asked or another moderator should have that ability. In fact, if, as in this case, no-one voted for the answer, and the posts keep piling in, then it should be a signal that the answer isn't correct and should be revoked and the issue further investigated.
    • Edited by Andreas Toth Thursday, February 18, 2016 5:26 AM
    Thursday, February 18, 2016 5:03 AM