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?
/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