Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

After Robocopy, the copied Directory and Files are not visible on the destination Drive

Tags:

robocopy

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

like image 522
Bill Campbell Avatar asked Jul 05 '11 14:07

Bill Campbell


People also ask

Does Robocopy overwrite destination files?

Robocopy normally overwrites those. /XN excludes existing files newer than the copy in the source directory. Robocopy normally overwrites those. /XO excludes existing files older than the copy in the source directory.

Does Robocopy create destination folder?

The most basic use of robocopy is using a source and destination directory with no options. This option will copy all files (excluding subfolders) from C:\src to C:\dst.

Does Robocopy copy hidden and system files?

The official doc at https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy does not even mention hidden or system attributes (as of 2020-02-01).

Why is Robocopy skipping all files?

SKIPPED via robocopy means that source and target versions of the file are same.. SO, it just skips the copy. You can use /is option to overwrite even the exactly same files. Welcome to Super User!


3 Answers

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".

like image 191
Ricky Avatar answered Oct 03 '22 22:10

Ricky


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.

like image 35
SherylHohman Avatar answered Oct 03 '22 23:10

SherylHohman


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.

like image 34
Ben01635 Avatar answered Oct 03 '22 21:10

Ben01635