批处理文件将文件从一个文件夹复制到另一个文件夹 [英] Batch file to copy files from one folder to another folder

查看:69
本文介绍了批处理文件将文件从一个文件夹复制到另一个文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网络上有一个存储文件夹,所有用户都将在其中将他们的活动数据存储在服务器上.现在由于位置问题,该服务器将被新服务器替换,因此我需要将子文件夹文件从旧服务器存储文件夹复制到新服务器存储文件夹.我有以下例子:

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:

来自Oldeserverstoragedata &文件到 New serverstoragedata &文件.

from Oldeserverstoragedata & files to New serverstoragedata & files.

推荐答案

xcopy.exe 绝对是您的朋友.它内置于 Windows 中,因此它的成本为零.

xcopy.exe is definitely your friend here. It's built into Windows, so its cost is nothing.

只需 xcopy/s c:source d: arget

您可能想要调整一些东西;我们还添加的一些选项包括:

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:source d: arget.

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: arget.

希望这会有所帮助.

这篇关于批处理文件将文件从一个文件夹复制到另一个文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆