I want to copy a directory(abc) from domain1/user1 to domain2/user1. any idea how to do this. e.g robocopy
robocopy \\server1\G$\testdir\%3 \\server2\g$\uploads
and both are on different domains
Using Robocopy over the network is a two-step process. You must first configure file sharing on the source device and then use Robocopy in the destination device to perform the transfer.
The Basics: Copying Files 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. You can also copy everything including subfolders (empty or not) and NTFS permissions.
Robocopy \\servername\d$\folder \\servername\E$\folder1\folder2\Dept\Accounting /E /ZB /COPYALL /MIR /R:0 /W:0 /V /TEE /log:"c:\temp\f_Copy.
Robocopy does not copy subdirectories by default. copy subdirectories, including Empty ones. Same as /S, but it also copies empty subdirectories. Will automatically add /S into the command.
Robocopy will use the standard windows authentication mechanism.
So you probably need to connect to the servers using the appropriate credentials before you issue the robocopy command.
You can use net use
to do this and you could put that in a batch script.
Note that Windows doesn't like you to connect to the same server with two different sets of credentials (so you can't copy from and to the same server as different users). But that's not what it looks like you need.
Something like this:
net use \\server1\g$ /user:domain1\user1 *
net use \\server2\g$ /user:domain2\user2 *
robocopy \\server1\G$\testdir\%3 \\server2\g$\uploads
Notes:
net use
to make sure it does what you need.You can probably also remove the network connection to the servers by using this (I haven't tried this with a deviceless connection):
net use \\server1\g$ /delete
net use \\server2\g$ /delete
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With