批处理文件从一个文件夹复制到另一个文件夹 [英] Batch file to copy files from one folder to another folder
问题描述
我具有其中所有用户都将存储在服务器上的活性的数据在网络上的存储文件夹。现在,服务器将通过一个新的更换,由于地方的问题,所以我需要的文件夹的子文件从旧服务器存储文件夹复制到新的服务器存储文件夹复制。下面我有恩:
I have a storage folder on a network in which all users will store their active data on a server. Now that server is going to be replaced by a new one due to place problem so I need to copy sub folders files from the old server storage folder to new server storage folder. I have below ex:
从\\ Oldeserver \\存储\\数据&安培;文件\\新服务器\\存储\\数据&安培;文件。
from \Oldeserver\storage\data & files to \New server\storage\data & files.
推荐答案
XCOPY.EXE 绝对是在这里你的朋友。
它内置于Windows,所以它的成本是什么。
xcopy.exe is definitely your friend here. It's built into Windows, so its cost is nothing.
只是 XCOPY /秒C:\\来源D:\\目标
您很可能需要调整一些东西;一些我们还添加选项包括这些:
You'd probably want to tweak a few things; some of the options we also add include these:
-
/ S / E
- 递归复制,包括复制空目录 。 -
/ V
- 添加此验证与原始副本。慢,但对于偏执。 -
/ H
- 副本系统和隐藏文件 。 -
/ K
- 复制只读处理文件的属性。否则,所有的文件变成可读写的。 -
/ X
- 如果你关心的权限,您可能希望/ O
或/ X
。 -
/ Y
- 覆盖现有文件之前不提示 -
/ Z
- 如果你想复制可能会失败,并且要重新启动它,使用它。它把对每个文件,因为它拷贝标记,这样你就可以重新运行xcopy命令从停止的地方接了。
/s/e
- recursive copy, including copying empty directories./v
- add this to verify the copy against the original. slower, but for the paranoid./h
- copy system and hidden files./k
- copy read-only attributes along with files. otherwise, all files become read-write./x
- if you care about permissions, you might want/o
or/x
./y
- don't prompt before overwriting existing files./z
- if you think the copy might fail and you want to restart it, use this. It places a marker on each file as it copies, so you can rerun the xcopy command to pick up from where it left off.
如果您认为XCOPY可能会失败,中途(当你复制了片状网络连接等),或者你必须停止它,并希望以后继续它,你可以使用 XCOPY / S / ZC:\\来源D:\\目标
If you think the xcopy might fail partway through (like when you are copying over a flaky network connection), or that you have to stop it and want to continue it later, you can use xcopy /s/z c:\source d:\target
.
希望这有助于。
这篇关于批处理文件从一个文件夹复制到另一个文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!