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?
1This 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. – 2011-06-08T10:47:37.330
It looks like a permissions issue. Can you create a folder manually, in the command prompt or through Windows Explorer? – aphoria – 2011-06-08T10:49:34.323
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 – None – 2011-06-08T10:52:16.267
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:
– nixda – 2013-07-20T07:10:41.793/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