close
【DOS】- robocopy指令範例參考
robocopy
來源參數
指令
robocopy C:\ D:\
無意間發現了robocopy這個指令。雖然還沒有機會用到,但還是先將其筆記下來。以備不時之需。
來源參數
/S : 複製每個目錄及其包含的子目錄,不複製空目錄 copy Subfolders
/E : 複製每個目錄及其包含的子目錄,也複製空目錄 copy Subfolders, including Empty Subfolders.
/SEC : 複製安全性 copy SECurity info (both source and dest must be NTFS).##
/A : 只複製設定成保存屬性的檔案,不要改變屬性的設定 copy only files with the Archive attribute set.
/M : 只複製設定成保存屬性的檔案,並清除保存屬性 like /A, but remove Archive attribute from source files.
/LEV:n : only copy the top n LEVels of the source tree.##
/MAXAGE:n : 排除比指定日期要舊的檔案 MAXimum file AGE - exclude files older than n days/date.##
/MINAGE:n : 排除比指定日期要新的檔案 MINimum file AGE - exclude files newer than n days/date.##
(If n < 1900 then n = n days, else n = YYYYMMDD date).
/L : 顯示要複製的檔案 List only - don't copy, timestamp or delete any files.
/MOV : 移動檔案 MOVe files (delete from source after copying).##
/MOVE : 移動檔案與資料夾 Move files and dirs (delete from source after copying).
/Z : 在可重新開始的模式中複製網路檔案 copy files in restartable mode (survive network glitch).##
/R:n : number of Retries on failed copies - default is 1 million.
/W:n : Wait time between retries - default is 30 seconds.
/REG : Save /R:n and /W:n in the Registry as default settings.
/TBD : wait for sharenames To Be Defined (retry error 67).##
目的地參數
/A+:[R][A][S][H] : set file Attributes on destination files - add.
/A-:[R][A][S][H] : set file Attributes on destination files - remove.
/FAT : 將目的檔案設定成FAT8.3名稱(不太了解意思) create destination files using 8.3 FAT file names only.##
/SECFIX : FIX SECurity info on existing files and dirs.##
/TimFix : FIX Timestamp on all existing destination files,
including skipped files. ##
(prior to version 1.95 this was /T it's not backwards compatible
so scripts that use /T may fail)
/CREATE : CREATE directory tree structure + zero-length files only.
/PURGE : 刪除目的檔案,當來源檔案已不存在時 delete dest files/folders that no longer exist in source.
/MIR : MIRror a directory tree - equivalent to /PURGE plus all subfolders (/E) ##
記錄參數
/L : 顯示要複製的檔案(前面也有個/L,但不知差異在哪) List only - don't copy, timestamp or delete any files.
/NP : 不要顯示拷貝的百分比 No Progress - don't display % copied.
/LOG:file : 將記錄複寫到記錄檔 output status to LOG file (overwrite existing log). ##
/LOG+:file : 將記錄附加到記錄檔 output status to LOG file (append to existing log). ##
進階參數
/XO : 排除目的檔案的日期跟來源檔案一樣或更新 eXclude Older - if destination file exists and is the same date
or newer than the source - don't bother to overwrite it.
/XC | /XN : 排除變更過的檔案 eXclude Changed | 排除新增的檔案 Newer files
/XX | /XL : eXclude eXtra | Lonely files and dirs.
An "extra" file is present in destination but not source,
excluding extras will delete from destination.
A "lonely" file is present in source but not destination
excluding lonely will prevent any new files being added to the destination.
/IS : 複寫檔案,既使他們是一樣的(不太了解意思) Overwrite files even if they are already the same.
/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
/MAX:n : 排除比指定bytes要大的檔案 MAXimum file size - exclude files bigger than n bytes. ##
/MIN:n : 排除比指定bytes要小的檔案 MINimum file size - exclude files smaller than n bytes.##
/XA:[R][A][S][H] : eXclude files with any of the given Attributes
/IA:[R][A][S][H] : Include files with any of the given Attributes ##
/X : report all eXtra files, not just those selected & copied.
/V : produce Verbose output log, showing skipped files.
/ETA : 顯示預估完成的時間 show Estimated Time of Arrival of copied files.
/S : 複製每個目錄及其包含的子目錄,不複製空目錄 copy Subfolders
/E : 複製每個目錄及其包含的子目錄,也複製空目錄 copy Subfolders, including Empty Subfolders.
/SEC : 複製安全性 copy SECurity info (both source and dest must be NTFS).##
/A : 只複製設定成保存屬性的檔案,不要改變屬性的設定 copy only files with the Archive attribute set.
/M : 只複製設定成保存屬性的檔案,並清除保存屬性 like /A, but remove Archive attribute from source files.
/LEV:n : only copy the top n LEVels of the source tree.##
/MAXAGE:n : 排除比指定日期要舊的檔案 MAXimum file AGE - exclude files older than n days/date.##
/MINAGE:n : 排除比指定日期要新的檔案 MINimum file AGE - exclude files newer than n days/date.##
(If n < 1900 then n = n days, else n = YYYYMMDD date).
複製參數
/L : 顯示要複製的檔案 List only - don't copy, timestamp or delete any files.
/MOV : 移動檔案 MOVe files (delete from source after copying).##
/MOVE : 移動檔案與資料夾 Move files and dirs (delete from source after copying).
/Z : 在可重新開始的模式中複製網路檔案 copy files in restartable mode (survive network glitch).##
/R:n : number of Retries on failed copies - default is 1 million.
/W:n : Wait time between retries - default is 30 seconds.
/REG : Save /R:n and /W:n in the Registry as default settings.
/TBD : wait for sharenames To Be Defined (retry error 67).##
目的地參數
/A+:[R][A][S][H] : set file Attributes on destination files - add.
/A-:[R][A][S][H] : set file Attributes on destination files - remove.
/FAT : 將目的檔案設定成FAT8.3名稱(不太了解意思) create destination files using 8.3 FAT file names only.##
/SECFIX : FIX SECurity info on existing files and dirs.##
/TimFix : FIX Timestamp on all existing destination files,
including skipped files. ##
(prior to version 1.95 this was /T it's not backwards compatible
so scripts that use /T may fail)
/CREATE : CREATE directory tree structure + zero-length files only.
/PURGE : 刪除目的檔案,當來源檔案已不存在時 delete dest files/folders that no longer exist in source.
/MIR : MIRror a directory tree - equivalent to /PURGE plus all subfolders (/E) ##
記錄參數
/L : 顯示要複製的檔案(前面也有個/L,但不知差異在哪) List only - don't copy, timestamp or delete any files.
/NP : 不要顯示拷貝的百分比 No Progress - don't display % copied.
/LOG:file : 將記錄複寫到記錄檔 output status to LOG file (overwrite existing log). ##
/LOG+:file : 將記錄附加到記錄檔 output status to LOG file (append to existing log). ##
進階參數
/XO : 排除目的檔案的日期跟來源檔案一樣或更新 eXclude Older - if destination file exists and is the same date
or newer than the source - don't bother to overwrite it.
/XC | /XN : 排除變更過的檔案 eXclude Changed | 排除新增的檔案 Newer files
/XX | /XL : eXclude eXtra | Lonely files and dirs.
An "extra" file is present in destination but not source,
excluding extras will delete from destination.
A "lonely" file is present in source but not destination
excluding lonely will prevent any new files being added to the destination.
/IS : 複寫檔案,既使他們是一樣的(不太了解意思) Overwrite files even if they are already the same.
/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
/MAX:n : 排除比指定bytes要大的檔案 MAXimum file size - exclude files bigger than n bytes. ##
/MIN:n : 排除比指定bytes要小的檔案 MINimum file size - exclude files smaller than n bytes.##
/XA:[R][A][S][H] : eXclude files with any of the given Attributes
/IA:[R][A][S][H] : Include files with any of the given Attributes ##
/X : report all eXtra files, not just those selected & copied.
/V : produce Verbose output log, showing skipped files.
/ETA : 顯示預估完成的時間 show Estimated Time of Arrival of copied files.
文章標籤
全站熱搜
留言列表