Robocopy_Dummy_needs_your_help_with_error_code_5 \$RECYCLE.BIN\

Jimmertwo 0 Reputation points
2023-06-10T08:15:02.8833333+00:00

Hello,

Thank you for looking.

I run this .bat file to give me a copy of external drive  E:\ (source) to external drive D:\ (dest):

robocopy E:\ D:\ /e /w:5 /r:2 /COPY:DATSOU /DCOPY:DAT /MT 

All has been well, until now when this message:
	
ERROR 5 (0x00000005) Accessing Destination Directory D:\$RECYCLE.BIN\

I was not aware I had a $RECYCLE.BIN in my file tree, and a search on Windows Explorer has drawn a blank.

A CHKDISK test is all clear.

I can access all folders on both drives normally.

Please can someone help with a fix?

I want to avoid changing the .bat string, as this has worked well in the past.

Many thanks

PS Please keep answers sinple for I am in the dummy bracket!
Microsoft Configuration Manager
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Olaf Helper 41,001 Reputation points
    2023-06-12T06:15:02.25+00:00

    ERROR 5 (0x00000005) Accessing Destination Directory

    System Error code 5 = ERROR_ACCESS_DENIED; it's a permission problem.

    I was not aware I had a $RECYCLE.BIN in my file tree

    Every drive has a hidden recycle bin folder.

    1 person found this answer helpful.
    0 comments No comments

  2. MotoX80 32,076 Reputation points
    2023-06-10T12:24:33.76+00:00

    Just tell robocopy to exclude that directory. You may also have a problem with "System Volume Information".

    Add this to your robocopy command so that it only copies your user folders.

    /XD $Recycle.Bin "System Volume Information"
    
    

    Open a command prompt with run as administrator and run this command to see all files and folders .

    dir /a E:\
    
    0 comments No comments

  3. Jimmertwo 0 Reputation points
    2023-06-10T18:18:48.5933333+00:00

    Many thanks for your reply.

    Before I saw your suggestion, I ended up wiping the drive (during which a warning about a corrupted recycle folder popped up), formatting, and running my .bat file again.

    This has me back to where I was before the issue arose, but, I would be very interested to know if you would still advise altering the robycopy command so it only copies user folders?

    Would the new command look like this?

    robocopy E:\ D:\ /e /w:5 /r:2 /COPY:DATSOU /DCOPY:DAT /MT/XD $Recycle.Bin "System Volume Information"

    Thanks again.