2

I am trying to write a batch file to copy all files and subfolders in a folder from my local machine to another machine on our network. I am trying to use the ROBOCOPY command and would like the command to either copy the files to an existing folder on the network machine, or create this folder should it not exist.

I am currently trying to get this to work in command line before writing my batch file as a means of testing but when running the ROBOCOPY command in command line to copy into a new folder I am getting an error of

"Error 5 (0x00000005) Creating Destination Directory \\servername\TEST\new folder\ Access is Denied"

When running the command to copy into an existing folder I get several errors, a few of the above errors (as the folder I'm trying to copy has subfolders), and for the files that are not in subfolders I get the following

"Error 5 (0x00000005) Accessing Destination Directory \\servername\TEST\existing folder\ Access is Denied"

"Error 5 (0x00000005) Changing File Attributes \\servername\TEST\existing folder\ Access is Denied"

I think all security and sharing properties are set up correctly (I can't say for sure as I don't know a whole lot about network settings, so feel free to add instructions if you think this will solve my issue)

The commands I have been trying are:

robocopy "D:\Test Program" "\\\servername\Test\new folder" /s /e /copyall /mir

robocopy "D:\Test Program" "\\\servername\Test\existing folder" /s /e /copyall /mir

Any ideas?

4
  • 1
    This is not a programming question. It seems that all your problems are the same "Access denied" error. So, you need to review the current user access rights to the remote folder.
    – PA.
    Jun 8, 2011 at 10:47
  • It looks like a permissions issue. Can you create a folder manually, in the command prompt or through Windows Explorer?
    – aphoria
    Jun 8, 2011 at 10:49
  • I can create a folder when using Remote Desktop to the network computer, but no I can't create a folder in the network location when navigating via Explorer
    – Newbie
    Jun 8, 2011 at 10:52
  • Hello Vermin, your main issue isn't robocopy. Its the folder permission as PA already said. Change them using this guide -- 2. Your robocopy can be improved: /S is redundant to /E. Delete /S -- 3. I would use /copy:dat instead of /copyall on a first attempt. This way you won't copy NTFS settings and owner info from your source
    – nixda
    Jul 20, 2013 at 7:10

1 Answer 1

1
  1. Try to Run this Batch File using Administrator Privileges
  2. Make sure the privileges on the Destination is accepting the application privilege

    • Suggestion :

    • If you are using the source and destination in a private server, make sure you set the READ/WRITE/FULL Control for Guest/ALL Users. After you've completed your copying, then set the permissions back to default . ( do this if you are doing this process only a couple of times not really a go if its done everyday )

1
  • unfortunately, this will be happening on a daily basis once its up and running. thanks for your help though!
    – Newbie
    Jun 8, 2011 at 11:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .