我想将 DVD 中的所有文件夹、子目录和文件(子目录除外)复制到硬盘驱动器,使用Robocopy
此路径执行此任务的命令是什么?
复制全部,D:\
排除D:\Programs\DVD IV\FileandDisk\Utilities\CCleaner
我不想复制CCleaner
其内容。
答案1
我不想复制 CCleaner 及其内容
这个任务的命令是什么?
使用/XD
(eX包括与给定名称/路径匹配的目录)选项。
robocopy D:\ {dest} /MIR /XD "D:\Programs\DVD IV\FileandDisk\Utilities\CCleaner"
笔记:
将其替换
{dest}
为您要复制到的文件夹的(完整或相对)路径名。例子:
C:\Backup
。如果
{dest}
包含spaces
它必须被引用。例子:
"C:\My Backup"
。/MIR
是和平号空间站ror 目录树 - 相当于/PURGE
加上所有子文件夹(/E)
(您可能也需要此选项)。"D:\Programs\DVD IV\FileandDisk\Utilities\CCleaner"
必须被引用,因为它包含spaces
。
目的地选项
/A+:[RASHCNET] : Set file Attribute(s) on destination files + add.
/A-:[RASHCNET] : UnSet file Attribute(s) on destination files - remove.
/FAT : Create destination files using 8.3 FAT file names only.
/CREATE : CREATE directory tree structure + zero-length files only.
/DST : Compensate for one-hour DST time differences.
/PURGE : Delete dest files/folders that no longer exist in source.
/MIR : MIRror a directory tree - equivalent to /PURGE plus all subfolders (/E)
您可能永远不会使用的高级选项
/EFSRAW : Copy any encrypted files using EFS RAW mode.
/MT[:n] : Multithreaded copying, n = no. of threads to use (1-128) #
default = 8 threads, not compatible with /IPG and /EFSRAW
The use of /LOG is recommended for better performance.
/SECFIX : FIX file SECurity on all files, even skipped files.
/TIMFIX : FIX file TIMes on all files, even skipped files.
/XO : eXclude Older - if destination file exists and is the same date
or newer than the source - don’t bother to overwrite it.
/XC : eXclude Changed files
/XN : eXclude Newer files
/XL : eXclude "Lonely" files and dirs (present in source but not destination)
This will prevent any new files being added to the destination.
/XX : eXclude "eXtra" files and dirs (present in destination but not source)
This will prevent any deletions from the destination. (this is the default)
/XF file [file]... : eXclude Files matching given names/paths/wildcards.
/XD dirs [dirs]... : eXclude Directories matching given names/paths.
XF and XD can be used in combination e.g.
ROBOCOPY c:\source d:\dest /XF *.doc *.xls /XD c:\unwanted /S
来源机器人复制
进一步阅读
- Windows CMD 命令行的 AZ 索引- 与 Windows cmd 行相关的所有事物的绝佳参考。
- 机器人复制- 强大的文件和文件夹复制。
答案2
从这里:
robocopy D:\ "c:\Target-Driectory" /MIR /XD "D:\Programs\DVD IV\FileandDisk\Utilities\CCleaner"
由于您没有指定目的地,我选择了 c:\Target-Driectory
/xd [...] 排除与指定名称和路径匹配的目录。