[英]robocopy or xcopy: copy directory and files
I want to use either robocopy or xcopy to copy a directory and its contents to a remote share. 我想使用robocopy或xcopy将目录及其内容复制到远程共享。
I have attempted this: 我已经尝试过了:
xcopy /E /V /C /I /H /Y "foo" \\172.16.254.41\c$\temp
foo\file.sql foo\file2.cmd
2 File(s) copied
This doesn't copy foo directory, though. 但是,这不会复制foo目录。
This will copy files and directories from the remote path to a local path: 这会将文件和目录从远程路径复制到本地路径:
robocopy \\172.16.254.41\c$\temp bar /E
But reversing it doesn't make a difference: 但是,将其反转并没有什么不同:
robocopy foo \\172.16.254.41\c$\temp /E
Total Copied Skipped Mismatch FAILED Extras
Dirs : 1 0 0 0 0 2
Files : 2 2 0 0 0 3
Bytes : 2.0 k 2.0 k 0 0 0 1.2 k
Times : 0:00:00 0:00:00 0:00:00 0:00:00
As you see, the directory foo was not copied over. 如您所见,目录foo没有被复制。
So what can be done to copy local directories+files to a remote path? 那么如何将本地目录和文件复制到远程路径呢?
---edit--- - -编辑 - -
with robocopy foo \\\\172.16.254.41\\c$\\temp /copyall /E
使用
robocopy foo \\\\172.16.254.41\\c$\\temp /copyall /E
Total Copied Skipped Mismatch FAILED Extras
Dirs : 1 0 0 0 0 2
Files : 2 2 0 0 0 3
Bytes : 2.0 k 2.0 k 0 0 0 1.2 k
Times : 0:00:00 0:00:00 0:00:00 0:00:00
Speed : 67419 Bytes/sec.
Speed : 3.857 MegaBytes/min.
Ended : Tuesday, September 20, 2016 10:25:27 PM
---edit2--- -编辑2 ---
robocopy "C:\directory here\foo" \\172.16.254.41\c$\temp /copyall /e
Results in the same: contents of foo copied to temp on destination, but not the foo directory itself. 结果相同:将foo的内容复制到目标位置的temp,但不复制foo目录本身。
---edit3--- -编辑3 ---
robocopy "C:\directory here" \\172.16.254.41\c$\temp /copyall /E
This will copy all contents and directories (including foo) inside "directory here", but I can't do that for this. 这将复制“这里的目录”中的所有内容和目录(包括foo),但是我不能这样做。 foo contains just two files, but I need the directory.
foo仅包含两个文件,但是我需要目录。 I must be doing something wrong with robocopy.
我对robocopy一定做错了。
如果您想要目录\\\\172.16.254.41\\c$\\temp\\foo
,则必须输入以下目录:
robocopy /e foo \\172.16.254.41\c$\temp\foo
You need to add /copyall
snippet to robocopy 您需要将
/copyall
片段添加到robocopy
robocopy full_path_to_your_foo_folder \\172.16.254.41\c$\temp /copyall /e
I assume that \\172.16.254.41\\c$\\temp is your destination folder. 我假设\\ 172.16.254.41 \\ c $ \\ temp是您的目标文件夹。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.