什么是比 Windows 默认的更好的文件复制替代方案?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1329/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is a better file copy alternative than the Windows default?
提问by Zack Peterson
I need to copy hundreds of gigs of random files around on my computer and am pretty leery of using the vanilla file copy built into Windows.
我需要在我的计算机上复制数百个随机文件,并且对使用 Windows 内置的 vanilla 文件副本非常谨慎。
I don't want it to hang on a "Are you sure?", "Are you really sure?", "Even zip files?", "Surely not read-only files too!" loop as soon as I step away.
我不希望它挂在“你确定吗?”、“你真的确定吗?”、“即使是 zip 文件?”、“当然也不是只读文件!” 我一走开就循环。
I don't want it to work for hours and then stop unexpectedly: "Someone once opened this file and so I won't copy it!" and then cancel the whole copy or just quit with no indication of what was done and what work remains.
我不希望它工作几个小时然后意外停止:“有人曾经打开过这个文件,所以我不会复制它!” 然后取消整个副本或只是退出而不指示已完成的工作和剩余的工作。
What file management programs do you have experience with? Which do you recommend?
您使用过哪些文件管理程序?你推荐哪个?
This question is related to my other question: How can I use an old PATA hard disk drive on my newer SATA-only computer?
这个问题与我的另一个问题有关:如何在较新的仅支持 SATA 的计算机上使用旧的 PATA 硬盘驱动器?
采纳答案by Michael Stum
How about good old Command-Line Xcopy? With S: being the source and T: the target:
好的旧命令行 Xcopy 怎么样?S:作为源,T:目标:
xcopy /K /R /E /I /S /C /H /G /X /Y s:\*.* t:\
/K Copies attributes. Normal Xcopy will reset read-only attributes.
/R Overwrites read-only files.
/E Copies directories and subdirectories, including empty ones.
/I If destination does not exist and copying more than one file, assumes that destination must be a directory.
/S Copies directories and subdirectories except empty ones.
/C Continues copying even if errors occur.
/H Copies hidden and system files also.
/Y Suppresses prompting to confirm you want to overwrite an existing destination file.
/G Allows the copying of encrypted files to destination that does not support encryption.
/X Copies file audit settings (implies /O).
/K 复制属性。普通 Xcopy 将重置只读属性。
/R 覆盖只读文件。
/E 复制目录和子目录,包括空目录。
/I 如果目标不存在并且复制多个文件,则假定目标必须是一个目录。
/S 复制目录和子目录,除了空目录。
/C 即使发生错误也继续复制。
/H 也复制隐藏文件和系统文件。
/Y 禁止确认您要覆盖现有目标文件的提示。
/G 允许将加密文件复制到不支持加密的目标。
/X 复制文件审核设置(隐含 /O)。
(Edit: Added /G and /X which are new since a few years)
(编辑:添加了 /G 和 /X 这是几年以来的新内容)
回答by huseyint
Use Robocopy (Robust File Copy).
NOTE:
笔记:
In Windows Vista and Server 2008 when you type:
在 Windows Vista 和 Server 2008 中键入:
xcopy /?
you get:
你得到:
NOTE: Xcopy is now deprecated, please use Robocopy.
注意:Xcopy 现在已弃用,请使用 Robocopy。
So start getting used to robocopy :)
所以开始习惯 robocopy :)
回答by hitec
I would definitely prefer:
我肯定更喜欢:
1) Teracopy- GUI based, replaces the default Windows copy/move UI and adds itself to context menu. Basic version is free (for home use I guess).
1) Teracopy- 基于 GUI,替换默认的 Windows 复制/移动 UI,并将其自身添加到上下文菜单中。基本版是免费的(我猜是供家庭使用)。
2) Robocopy- CLI based, useful when scripting. Free tool from MS and is included in Vista/Windows 2008. MS Technet has a GUI for robocopy as well - useful to create statements that you can later embed in scripts or on the command prompt.
2) Robocopy- 基于 CLI,在编写脚本时很有用。MS 提供的免费工具,包含在 Vista/Windows 2008 中。MS Technet 也有一个用于 robocopy 的 GUI - 有助于创建您以后可以嵌入脚本或命令提示符的语句。
PS: I know these have been already suggested here and I would have voted on them, if I could.
PS:我知道这里已经提出了这些建议,如果可以的话,我会投票给它们。
回答by Adam Haile
You really need to use a file Sync tool, like SyncBackSE, MS SyncToy, or even something like WinMergewill do the trick. I prefer SyncBack as it allows you to set up very explicit rules for just about every possible case and conflict, at least more so than the other two. With any of these you won't have to keep clicking all the pop-ups and you can verify, without a doubt, that the destination is exactly the same as the source.
您确实需要使用文件同步工具,例如SyncBackSE、MS SyncToy,甚至WinMerge 之类的工具都可以解决问题。我更喜欢 SyncBack,因为它允许您为几乎所有可能的情况和冲突设置非常明确的规则,至少比其他两个规则更多。使用这些中的任何一个,您都不必一直单击所有弹出窗口,并且可以毫无疑问地验证目标与源完全相同。
回答by Vincent Robert
You can try SuperCopier, it replaces the standard Windows copy mechanism while loaded.
您可以尝试SuperCopier,它在加载时替换标准的 Windows 复制机制。
It can retry failed files at the end, resume a canceled copy (even a copy canceled by Windows), accepts "All" for every answers. You can even answer the annoying questions (file already exists, error copying file) before they occur.
它可以在最后重试失败的文件,恢复取消的副本(甚至是被 Windows 取消的副本),为每个答案接受“全部”。您甚至可以在它们发生之前回答烦人的问题(文件已存在、复制文件时出错)。
回答by SAL
Big thumbs up for robocopy. I use it for doing the sort of things you mention.
为 robocopy 竖起大拇指。我用它来做你提到的那种事情。
For example I'm currently running 5 robocopy sessions on my server where I'm copying about 60GB of files between 3 remote servers, I'm connected to two via a CheckPoint VPN and the other is an Amazon S3 space mapped via JungleDisk.
例如,我目前在我的服务器上运行 5 个 robocopy 会话,我在 3 个远程服务器之间复制大约 60GB 的文件,我通过 CheckPoint VPN 连接到两个,另一个是通过 JungleDisk 映射的 Amazon S3 空间。
I'm working with a colleague at the other end of the country. He'll log in to the same servers later tonight and run a similar set of robocopy batch files to download all the changes I'm currently uploading.
我正在与该国另一端的一位同事一起工作。他将在今晚晚些时候登录同一台服务器并运行一组类似的 robocopy 批处理文件来下载我当前正在上传的所有更改。
The 'killer app' feature is that robocopy will retain file date/time stamps and, by default will ONLY copy files that are different. So you can point it at a huge dir tree and only changed files will be copied.
“杀手级应用”功能是 robocopy 将保留文件日期/时间戳,并且默认情况下只会复制不同的文件。因此,您可以将其指向一个巨大的目录树,并且只会复制更改的文件。
Here's some useful tips for doing this sort of thing...
这里有一些有用的提示来做这种事情......
/MIR
mirrors a dir tree so will delete as well as add
/MIR
镜像目录树,因此将删除和添加
/R:10
tells robocopy to try 10 times to copy the file before giving up. The default is 1,000,000 times
/R:10
告诉 robocopy 在放弃之前尝试 10 次复制文件。默认为 1,000,000 次
/LOG+somefilename.log
will append the screen output to somefilename.log, creating it if necessary.
/LOG+somefilename.log
将屏幕输出附加到 somefilename.log,必要时创建它。
/XD dir1 dir2
will ignore any dirs named dir1 or dir2 in the copy. Wildcards can be used.
/XD dir1 dir2
将忽略副本中名为 dir1 或 dir2 的任何目录。可以使用通配符。
/FFT
will use FAT time stamps which are less accurate than NTFS (uses a 2 sec granularity in timestamps). I also find this one useful when copying between Linux file systems and NTFS.
/FFT
将使用不如 NTFS 准确的 FAT 时间戳(在时间戳中使用 2 秒粒度)。我还发现这在 Linux 文件系统和 NTFS 之间复制时很有用。
I typically use something like
我通常使用类似的东西
robocopy d:\workdir y:\workdir /TEE /LOG+:d:\update.log /MIR /R:5
which will mirror (/MIR) d:\workdir with y:\workdir, append a log of what it does to d:\update.log (/LOG+d:\update.log) writing output to both the console and the log file (/TEE), and try each file 5 times before moving on to the next one.
它将镜像 (/MIR) d:\workdir 与 y:\workdir,将它所做的日志附加到 d:\update.log (/LOG+d:\update.log) 将输出写入控制台和日志文件 (/TEE),并在继续下一个文件之前尝试每个文件 5 次。
It also works with UNC paths.
它也适用于 UNC 路径。
If you've got a large collection of files that need syncing over a number of PCs then robocopy is your friend.
如果您有大量文件需要在多台 PC 上同步,那么 robocopy 就是您的朋友。
回答by Terminus
Besides XCOPY, RoboCopy and TeraCopy that have already been suggested, you may also try out Total Commander.
除了已经推荐的 XCOPY、RoboCopy 和 TeraCopy,您还可以尝试 Total Commander。
回答by Chris Miller
Use Robocopy, it has the ability to copy files in "restartable mode", plus it should respect the file attributes. And it comes with Vista and Server 2008, and you can download it for older OS's. Plus you can set it to retry on failed copies, to pick up files that are temporarily in use by another process.
使用Robocopy,它具有在“可重启模式”下复制文件的能力,而且它应该尊重文件属性。它带有 Vista 和 Server 2008,您可以为旧操作系统下载它。此外,您可以将其设置为重试失败的副本,以获取其他进程暂时使用的文件。
回答by Michael Haren
It sounds like a backup-style tool may be what you're looking for.
听起来您可能正在寻找备份式工具。
I've been using SyncBack(one of the versions is free). You could also try out MS SyncToywhich tries to make moving, copying, syncing, etc. easy.
我一直在使用SyncBack(其中一个版本是免费的)。您还可以尝试尝试使移动、复制、同步等变得容易的MS SyncToy。
If you really do copy just random files at random times, you could try Total Copywhich has the added benefit of working well over a network (pause, resume, etc.).
如果您真的只是在随机时间复制随机文件,您可以尝试Total Copy,它具有在网络上运行良好(暂停、恢复等)的额外好处。