robocopy
$ robocopy \\QNAP\Pictures\Capture_One d:\pictures\capture1 /s /e /xf *.raf *.thumbs *.ds_store
https://gyazo.com/08eca499215b8de0304f1932d0506c4b
code:robocopy /?
C:\Users\tenshi>robocopy /?
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : 2021年6月16日 15:37:29
Usage :: ROBOCOPY source destination [file file...] options source :: Source Directory (drive:\path or \\server\share\path).
destination :: Destination Dir (drive:\path or \\server\share\path).
file :: File(s) to copy (names/wildcards: default is "*.*").
::
:: Copy options :
::
/S :: copy Subdirectories, but not empty ones.
/E :: copy subdirectories, including Empty ones.
/LEV:n :: only copy the top n LEVels of the source directory tree.
/Z :: copy files in restartable mode.
/B :: copy files in Backup mode.
/ZB :: use restartable mode; if access denied use Backup mode.
/J :: copy using unbuffered I/O (recommended for large files).
/EFSRAW :: copy all encrypted files in EFS RAW mode.
/COPY:copyflags :: what to COPY for files (default is /COPY:DAT). (copyflags : D=Data, A=Attributes, T=Timestamps, X=Skip alt data streams).
(S=Security=NTFS ACLs, O=Owner info, U=aUditing info).
/SEC :: copy files with SECurity (equivalent to /COPY:DATS).
/COPYALL :: COPY ALL file info (equivalent to /COPY:DATSOU).
/NOCOPY :: COPY NO file info (useful with /PURGE).
/SECFIX :: FIX file SECurity on all files, even skipped files.
/TIMFIX :: FIX file TIMes on all files, even skipped files.
/PURGE :: delete dest files/dirs that no longer exist in source.
/MIR :: MIRror a directory tree (equivalent to /E plus /PURGE).
/MOV :: MOVe files (delete from source after copying).
/MOVE :: MOVE files AND dirs (delete from source after copying).
/A+:RASHCNET :: add the given Attributes to copied files. /A-:RASHCNET :: remove the given Attributes from copied files. /CREATE :: CREATE directory tree and zero-length files only.
/FAT :: create destination files using 8.3 FAT file names only.
/256 :: turn off very long path (> 256 characters) support.
/MON:n :: MONitor source; run again when more than n changes seen.
/MOT:m :: MOnitor source; run again in m minutes Time, if changed.
/RH:hhmm-hhmm :: Run Hours - times when new copies may be started.
/PF :: check run hours on a Per File (not per pass) basis.
/IPG:n :: Inter-Packet Gap (ms), to free bandwidth on slow lines.
/SJ :: copy Junctions as junctions instead of as the junction targets.
/SL :: copy Symbolic Links as links instead of as the link targets.
/MT:n :: Do multi-threaded copies with n threads (default 8). n must be at least 1 and not greater than 128.
This option is incompatible with the /IPG and /EFSRAW options.
Redirect output using /LOG option for better performance.
/DCOPY:copyflags :: what to COPY for directories (default is /DCOPY:DA). (copyflags : D=Data, A=Attributes, T=Timestamps, E=EAs, X=Skip alt data streams).
/NODCOPY :: COPY NO directory info (by default /DCOPY:DA is done).
/NOOFFLOAD :: copy files without using the Windows Copy Offload mechanism.
/COMPRESS :: Request network compression during file transfer, if applicable.
::
:: File Selection Options :
::
/A :: copy only files with the Archive attribute set.
/M :: copy only files with the Archive attribute and reset it.
/IA:RASHCNETO :: Include only files with any of the given Attributes set. /XA:RASHCNETO :: eXclude files with any of the given Attributes set. /XF file file... :: eXclude Files matching given names/paths/wildcards. /XD dirs dirs... :: eXclude Directories matching given names/paths. /XC :: eXclude Changed files.
/XN :: eXclude Newer files.
/XO :: eXclude Older files.
/XX :: eXclude eXtra files and directories.
/XL :: eXclude Lonely files and directories.
/IS :: Include Same files.
/IT :: Include Tweaked files.
/MAX:n :: MAXimum file size - exclude files bigger than n bytes.
/MIN:n :: MINimum file size - exclude files smaller than n bytes.
/MAXAGE:n :: MAXimum file AGE - exclude files older than n days/date.
/MINAGE:n :: MINimum file AGE - exclude files newer than n days/date.
/MAXLAD:n :: MAXimum Last Access Date - exclude files unused since n.
/MINLAD:n :: MINimum Last Access Date - exclude files used since n.
(If n < 1900 then n = n days, else n = YYYYMMDD date).
/FFT :: assume FAT File Times (2-second granularity).
/DST :: compensate for one-hour DST time differences.
/XJ :: eXclude symbolic links (for both files and directories) and Junction points.
/XJD :: eXclude symbolic links for Directories and Junction points.
/XJF :: eXclude symbolic links for Files.
/IM :: Include Modified files (differing change times).
::
:: Retry Options :
::
/R:n :: number of Retries on failed copies: default 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).
/LFSM :: Operate in low free space mode, enabling copy pause and resume (see Remarks).
::
:: Logging Options :
::
/L :: List only - don't copy, timestamp or delete any files.
/X :: report all eXtra files, not just those selected.
/V :: produce Verbose output, showing skipped files.
/TS :: include source file Time Stamps in the output.
/FP :: include Full Pathname of files in the output.
/BYTES :: Print sizes as bytes.
/NS :: No Size - don't log file sizes.
/NC :: No Class - don't log file classes.
/NFL :: No File List - don't log file names.
/NDL :: No Directory List - don't log directory names.
/NP :: No Progress - don't display percentage copied.
/ETA :: show Estimated Time of Arrival of copied files.
/LOG:file :: output status to LOG file (overwrite existing log).
/LOG+:file :: output status to LOG file (append to existing log).
/UNILOG:file :: output status to LOG file as UNICODE (overwrite existing log).
/UNILOG+:file :: output status to LOG file as UNICODE (append to existing log).
/TEE :: output to console window, as well as the log file.
/NJH :: No Job Header.
/NJS :: No Job Summary.
/UNICODE :: output status as UNICODE.
::
:: Job Options :
::
/JOB:jobname :: take parameters from the named JOB file.
/SAVE:jobname :: SAVE parameters to the named job file
/QUIT :: QUIT after processing command line (to view parameters).
/NOSD :: NO Source Directory is specified.
/NODD :: NO Destination Directory is specified.
/IF :: Include the following Files.
::
:: Remarks :
::
Using /PURGE or /MIR on the root directory of the volume formerly caused
robocopy to apply the requested operation on files inside the System
Volume Information directory as well. This is no longer the case; if
either is specified, robocopy will skip any files or directories with that
name in the top-level source and destination directories of the copy session.
The modified files classification applies only when both source
and destination filesystems support change timestamps (e.g., NTFS)
and the source and destination files have different change times but are
otherwise the same. These files are not copied by default; specify /IM
to include them.
The /DCOPY:E flag requests that extended attribute copying should be
attempted for directories. Note that currently robocopy will continue
if a directory's EAs could not be copied. This flag is also not included
in /COPYALL.
Using /LFSM requests robocopy to operate in 'low free space mode'.
In that mode, robocopy will pause whenever a file copy would cause the
destination volume's free space to go below a 'floor' value, which
can be explicitly specified by the LFSM:nKMG form of the flag. If /LFSM is specified with no explicit floor value, the floor is set to
ten percent of the destination volume's size.
Low free space mode is incompatible with /MT, /EFSRAW, /B, and /ZB.
C:\Users\tenshi>
robocopy
03/17/2021
Copies file data from one location to another.
ファイルのデータをある場所から別の場所にコピーします。
Syntax
構文
robocopy <source> <destination> [<file>[ ...]] [<options>]
For example, to copy a file named yearly-report.mov from c:\reports to a file share \\marketing\videos while enabling multi-threading for higher performance (with the /mt parameter) and the ability to restart the transfer in case it's interrupted (with the /z parameter), type:
dos
例えば、ファイル名 yearly-report.mov を c:\reports からファイル共有の\marketing\videos にコピーする場合、マルチスレッドによるパフォーマンスの向上(/mt パラメーター)と、転送が中断された場合の再起動機能(/z パラメーター)を有効にして、次のように入力します。
$ robocopy c:\reports '\\marketing\videos' yearly-report.mov /mt /z
Parameters
table:Parameters
Parameter Description
<source> Specifies the path to the source directory.
<destination> Specifies the path to the destination directory.
<file> Specifies the file or files to be copied. Wildcard characters (* or ?) are supported. If you don't specify this parameter, *.* is used as the default value.
<options> Specifies the options to use with the robocopy command, including copy, file, retry, logging, and job options.
Copy options
table:Copy options
Option Description
/s Copies subdirectories. This option automatically excludes empty directories.
/e Copies subdirectories. This option automatically includes empty directories.
/lev:<n> Copies only the top n levels of the source directory tree.
/z Copies files in restartable mode. In restartable mode, should a file copy be interrupted, Robocopy can pick up where it left off rather than re-copying the entire file.
/b Copies files in backup mode. Backup mode allows Robocopy to override file and folder permission settings (ACLs). This allows you to copy files you might otherwise not have access to, assuming it's being run under an account with sufficient privileges.
/zb Copies files in restartable mode. If file access is denied, switches to backup mode.
/j Copies using unbuffered I/O (recommended for large files).
/efsraw Copies all encrypted files in EFS RAW mode.
/copy:<copyflags> Specifies which file properties to copy. The valid values for this option are:
D - Data
A - Attributes
T - Time stamps
S - NTFS access control list (ACL)
O - Owner information
U - Auditing information
The default value for this option is DAT (data, attributes, and time stamps).
/dcopy:<copyflags> Specifies what to copy in directories. The valid values for this option are:
D - Data
A - Attributes
T - Time stamps
The default value for this option is DA (data and attributes).
/sec Copies files with security (equivalent to /copy:DATS).
/copyall Copies all file information (equivalent to /copy:DATSOU).
/nocopy Copies no file information (useful with /purge).
/secfix Fixes file security on all files, even skipped ones.
/timfix Fixes file times on all files, even skipped ones.
/purge Deletes destination files and directories that no longer exist in the source. Using this option with the /e option and a destination directory, allows the destination directory security settings to not be overwritten.
/mir Mirrors a directory tree (equivalent to /e plus /purge). Using this option with the /e option and a destination directory, overwrites the destination directory security settings.
/mov Moves files, and deletes them from the source after they are copied.
/move Moves files and directories, and deletes them from the source after they are copied.
/a+:RASHCNET Adds the specified attributes to copied files. The valid values for this option are: R - Read only
A - Archive
S - System
H - Hidden
C - Compressed
N - Not content indexed
E - Encrypted
T - Temporary
/a-:RASHCNET Removes the specified attributes from copied files. The valid values for this option are: R - Read only
A - Archive
S - System
H - Hidden
C - Compressed
N - Not content indexed
E - Encrypted
T - Temporary
/create Creates a directory tree and zero-length files only.
/fat Creates destination files by using 8.3 character-length FAT file names only.
/256 Turns off support for paths longer than 256 characters.
/mon:<n> Monitors the source, and runs again when more than n changes are detected.
/mot:<m> Monitors the source, and runs again in m minutes, if changes are detected.
/MT:n Creates multi-threaded copies with n threads. n must be an integer between 1 and 128. The default value for n is 8. For better performance, redirect your output using /log option. The /mt parameter can't be used with the /ipg and /efsraw parameters.
/rh:hhmm-hhmm Specifies run times when new copies may be started.
/pf Checks run times on a per-file (not per-pass) basis.
/ipg:n Specifies the inter-packet gap to free bandwidth on slow lines.
/sl Don't follow symbolic links and instead create a copy of the link.
/nodcopy Copies no directory info (the default /dcopy:DA is done).
/nooffload Copies files without using the Windows Copy Offload mechanism.
/compress Requests network compression during file transfer, if applicable.
Important
When using the /secfix copy option, specify the type of security information you want to copy, using one of these additional copy options:
/copyall
/copy:o
/copy:s
/copy:u
/sec
File selection options
table:File selection options
Option Description
/a Copies only files for which the Archive attribute is set.
/m Copies only files for which the Archive attribute is set, and resets the Archive attribute.
/ia:RASHCNETO Includes only files for which any of the specified attributes are set. The valid values for this option are: R - Read only
A - Archive
S - System
H - Hidden
C - Compressed
N - Not content indexed
E - Encrypted
T - Temporary
O - Offline
/xa:RASHCNETO Excludes files for which any of the specified attributes are set. The valid values for this option are: R - Read only
A - Archive
S - System
H - Hidden
C - Compressed
N - Not content indexed
E - Encrypted
T - Temporary
O - Offline
/xf <filename> ... Excludes files that match the specified names or paths. Wildcard characters (* and ?) are supported. /xd <directory> ... Excludes directories that match the specified names and paths. /xc Excludes existing files with the same timestamp, but different file sizes.
/xn Excludes existing files newer than the copy in the source directory.
/xo Excludes existing files older than the copy in the source directory.
/xx Excludes extra files and directories present in the destination but not the source. Excluding extra files will not delete files from the destination.
/xl Excludes "lonely" files and directories present in the source but not the destination. Excluding lonely files prevents any new files from being added to the destination.
/is Includes the same files. Same files are identical in name, size, times, and all attributes.
/it Includes "tweaked" files. Tweaked files have the same name, size, and times, but different attributes.
/max:<n> Specifies the maximum file size (to exclude files bigger than n bytes).
/min:<n> Specifies the minimum file size (to exclude files smaller than n bytes).
/maxage:<n> Specifies the maximum file age (to exclude files older than n days or date).
/minage:<n> Specifies the minimum file age (exclude files newer than n days or date).
/maxlad:<n> Specifies the maximum last access date (excludes files unused since n).
/minlad:<n> Specifies the minimum last access date (excludes files used since n) If n is less than 1900, n specifies the number of days. Otherwise, n specifies a date in the format YYYYMMDD.
/xj Excludes junction points, which are normally included by default.
/fft Assumes FAT file times (two-second precision).
/dst Compensates for one-hour DST time differences.
/xjd Excludes junction points for directories.
/xjf Excludes junction points for files.
Retry options
table:Retry options
Option Description
/r:<n> Specifies the number of retries on failed copies. The default value of n is 1,000,000 (one million retries).
/w:<n> Specifies the wait time between retries, in seconds. The default value of n is 30 (wait time 30 seconds).
/reg Saves the values specified in the /r and /w options as default settings in the registry.
/tbd Specifies that the system will wait for share names to be defined (retry error 67).
Logging options
table:Logging options
Option Description
/l Specifies that files are to be listed only (and not copied, deleted, or time stamped).
/x Reports all extra files, not just those that are selected.
/v Produces verbose output, and shows all skipped files.
/ts Includes source file time stamps in the output.
/fp Includes the full path names of the files in the output.
/bytes Prints sizes, as bytes.
/ns Specifies that file sizes are not to be logged.
/nc Specifies that file classes are not to be logged.
/nfl Specifies that file names are not to be logged.
/ndl Specifies that directory names are not to be logged.
/np Specifies that the progress of the copying operation (the number of files or directories copied so far) will not be displayed.
/eta Shows the estimated time of arrival (ETA) of the copied files.
/log:<logfile> Writes the status output to the log file (overwrites the existing log file).
/log+:<logfile> Writes the status output to the log file (appends the output to the existing log file).
/unicode Displays the status output as Unicode text.
/unilog:<logfile> Writes the status output to the log file as Unicode text (overwrites the existing log file).
/unilog+:<logfile> Writes the status output to the log file as Unicode text (appends the output to the existing log file).
/tee Writes the status output to the console window, as well as to the log file.
/njh Specifies that there is no job header.
/njs Specifies that there is no job summary.
Job options
table:Job options
Option Description
/job:<jobname> Specifies that parameters are to be derived from the named job file.
/save:<jobname> Specifies that parameters are to be saved to the named job file.
/quit Quits after processing command line (to view parameters).
/nosd Indicates that no source directory is specified.
/nodd Indicates that no destination directory is specified.
/if Includes the specified files.
Exit (return) codes
table:Exit (return) codes
Value Description
0 No files were copied. No failure was encountered. No files were mismatched. The files already exist in the destination directory; therefore, the copy operation was skipped.
1 All files were copied successfully.
2 There are some additional files in the destination directory that are not present in the source directory. No files were copied.
3 Some files were copied. Additional files were present. No failure was encountered.
5 Some files were copied. Some files were mismatched. No failure was encountered.
6 Additional files and mismatched files exist. No files were copied and no failures were encountered. This means that the files already exist in the destination directory.
7 Files were copied, a file mismatch was present, and additional files were present.
8 Several files did not copy.
Note
Any value greater than 8 indicates that there was at least one failure during the copy operation.
Additional References
Command-Line Syntax Key
robocopy
2021/03/17
ある場所から別の場所にファイルデータをコピーします。
構文
たとえば、 yearly-report という名前のファイルをファイル共有 \ \ marketing\videos にコピーし、マルチスレッドを有効にして ( /mt パラメーターを使用して)、中断された場合に ( /z パラメーターを使用して) 転送を再開 できるように するには、次のように入力します。
code:dos
C:\> robocopy c:\reports '\\marketing\videos' yearly-report.mov /mt /z
パラメーター
table:パラメーター
パラメーター 説明
<source> コピー元ディレクトリのパスを指定します。
<destination> コピー先ディレクトリのパスを指定します。
<file> ファイルをコピーするファイルを指定します。 ワイルドカード文字 (* または ?) がサポートされています。
このパラメーターを指定しない場合、 *.* は既定値として使用されます。
<options> コピー、ファイル、再試行、ログ、ジョブ オプションなど、 robocopy コマンドで使用するオプションを指定します。
コピーオプション
table:コピーオプション
オプション 説明
/s サブディレクトリをコピーします。このオプションは、空のディレクトリを自動的に除外します。
/e サブディレクトリをコピーします。このオプションは、空のディレクトリを自動的に含みます。
/lev:<n> ソースディレクトリツリーの上位 n レベルのみをコピーします。
/z 再起動可能なモードでファイルをコピーします。
再起動可能なモードでは、ファイルのコピーが中断された場合、Robocopyはファイル全体を再コピーする
のではなく、中断したところから再開することができます。
/b バックアップモードでファイルをコピーします。
バックアップモードでは、ファイルやフォルダの権限設定(ACL)を上書きすることができます。
これにより、十分な権限を持ったアカウントで実行されていることを前提に、
通常ではアクセスできないファイルをコピーすることができます。
/zb 再起動可能なモードでファイルをコピーします。
ファイルへのアクセスが拒否された場合は、バックアップモードに切り替わります。
/j アンバッファード I/O を使用してコピーします(大きなファイルに推奨)。
/efsraw 暗号化されたすべてのファイルを EFS RAW モードでコピーします。
/copy:<copyflags> コピーするファイルのプロパティを指定します。このオプションの有効な値は次のとおりです。
D - データ
A - 属性
T - タイムスタンプ
S - NTFSアクセスコントロールリスト(ACL)
O - オーナー情報
U - 監査情報
このオプションの既定値は DAT (データ、属性、およびタイムスタンプ) です。
/dcopy:<copyflags> ディレクトリにコピーする内容を指定します。このオプションの有効な値は次のとおりです。
D -データ
A -属性
T タイムスタンプ
このオプションの既定値は、 DA (データと属性) です。
/sec セキュリティで保護されたファイルをコピーします ( /copy: DATS と同等)。
/copyall すべてのファイル情報のコピー ( /copy:DATSOU に相当)。
/nocopy ファイルの情報をコピーしません(/purge と一緒に使うと便利です)。
/secfix スキップされたファイルも含めて、すべてのファイルのセキュリティを修正します。
/timfix スキップされたファイルも含めて、すべてのファイルの時間を修正します。
/purge リンク先のファイルとソースに存在しなくなったディレクトリを削除します。
このオプションを /e オプションおよび destination ディレクトリと共に使用すると、
宛先ディレクトリのセキュリティ設定を上書きできなくなります。
/mir ディレクトリ ツリーをミラーリングします (/e と /purge の組み合わせに相当します)。
このオプションを /e オプションと目的のディレクトリで使用すると、
目的のディレクトリのセキュリティ設定が上書きされます。
/mov ファイルを移動し、コピーした後に、ソースからも削除します。
/move ファイルとディレクトリを移動し、コピーした後に、ソースからも削除します。
/a +: [RASHCNET] コピーしたファイルに指定された属性を追加します。 このオプションの有効な値は次のとおりです。
R -読み取り専用
A -アーカイブ
S -システム
H -非表示
C -圧縮
N -コンテンツがインデックス化されていません
電子 暗号化
T -一時的
/a -: [RASHCNET] コピーしたファイルから、指定された属性を削除します。 このオプションの有効な値は次のとおりです。
R -読み取り専用
A -アーカイブ
S -システム
H -非表示
C -圧縮
N -コンテンツがインデックス化されていません
電子 暗号化
T -一時的
/create ディレクトリ ツリー、長さゼロのファイルのみを作成します。
/fat 8.3 形式の文字長 FAT ファイル名のみを使用して、リンク先のファイルを作成します。
/256 256文字を超えるパスのサポートをオフにします。
/mon<n> ソースを監視し、 n 個以上の変更が検出されたときに実行を再開します。
/mot:<m> 変更が検出された場合、ソースを監視し、 m 分後にもう一度実行します。
/MT[:n] N 個 のスレッドでマルチスレッドコピーを作成します。 n には、1 ~ 128 の整数を指定してください。
N の既定値は8です。
パフォーマンスを向上させるには、 /log オプションを使用して出力をリダイレクトします。
/Mt パラメーターを /ipg および /efsraw パラメーターと共に使用することはできません。
/rh:hhmm-hhmm 新しいコピーを起動するときに実行時間を指定します。
/pf ファイルごと(パスごとではない)に実行時間をチェックします。
/ipg:n 低速回線の帯域幅を解放する間のパケットの間隔を指定します。
/sl シンボリックリンクに従わず、代わりにリンクのコピーを作成します。
/nodcopy ディレクトリ情報をコピーしません (既定の /dcopy: DA は完了します)。
/nooffload Windows コピーオフロードメカニズムを使用せずにファイルをコピーします。
/compress ファイル転送中にネットワーク圧縮を要求します (該当する場合)。
重要
/Secfix copy オプションを使用する場合は、次の追加のコピーオプションのいずれかを使用して、コピーするセキュリティ情報の種類を指定します。
/copyall
/copy: o
/copy: s
/copy: u
/sec
ファイルの選択オプション
table:ファイルの選択オプション
オプション 説明
/a 対象のファイルのみをコピー、 アーカイブ 属性を設定します。
/m 対象のファイルのみをコピー、 アーカイブ 属性が設定されているし、リセット、 アーカイブ 属性です。
/ia:[RASHCNETO] 指定した属性のいずれかが設定する対象のファイルのみが含まれます。
このオプションの有効な値は次のとおりです。
R -読み取り専用
A -アーカイブ
S -システム
H -非表示
C -圧縮
N -コンテンツがインデックス化されていません
E - 暗号化
T -一時的
O -オフライン
/xa:[RASHCNETO] 指定した属性のいずれかが設定する対象のファイルを除外します。
このオプションの有効な値は次のとおりです。
R -読み取り専用
A -アーカイブ
S -システム
H -非表示
C -圧縮
N -コンテンツがインデックス化されていません
E - 暗号化
T -一時的
O -オフライン
/xf <filename>[ ...] 指定された名前またはパスに一致するファイルを除外します。
ワイルドカード文字 (* と ?) も使用できます。
/xd <directory>[ ...] 指定した名前とパスに一致するディレクトリを除外します。
/xc タイムスタンプが同じで、ファイルサイズが異なる既存のファイルを除外します。
/xn ソースディレクトリのコピーよりも新しい既存ファイルを除外します。。
/xo ソースディレクトリ内のコピーよりも古い既存のファイルを除外します。
/xx 送信先にあって送信元にない余分なファイルやディレクトリを除外します。
余分なファイルを除外しても、コピー先のファイルは削除されません。
/xl ソースにはあってもデスティネーションにはない「孤独な」ファイルとディレクトリを除外します。
孤独なファイルを除外すると、宛先に新しいファイルが追加されなくなります。
/is 同じファイルを含めます。 同じファイルは、名前、サイズ、時刻、およびすべての属性で同じです。
/it "tweaked "ファイルを含みます。
ツイークされたファイルは、名前、サイズ、時間は同じですが、属性が異なります。
/max:<n> ファイルの最大サイズを指定します ( n バイトより大きいファイルを除外する場合)。
/min<n> ファイルの最小サイズを指定します ( n バイトよりも小さいファイルを除外する場合)。
maxage<n> ファイルの最大有効期間を指定します ( n 日または日付より前のファイルを除外します)。
/minage:<n> ファイルの最小経過期間を指定します ( n 日または日付よりも新しいファイルは除外されます)。
/maxlad:<n> 最後にアクセスした日付の最大値を指定します ( n 以降に使用されていないファイルは除外します)。
/minlad:<n> 最後のアクセス日付の最小値を指定します ( n 以降に使用されたファイルを除く)。
n が1900未満の場合、 n は日数を指定します。 それ以外の場合、 n は YYYYMMDD 形式の日付を指定します。
/xj ジャンクションポイントを除外します(通常はデフォルトで含まれる)。
/fft FATファイルの時間を想定します(2秒単位)。
/dst 1時間のサマータイムの時差を補正します。
/xjd ディレクトリのジャンクションポイントを除外します。
/xjf ファイルのジャンクションポイントを除外します。
再試行オプション
table:再試行オプション
オプション 説明
/r:<n> コピーに失敗したときの再試行回数を指定します。n のデフォルト値は 1,000,000(100万回)です。
/w:<n> 再試行の間の待機時間を秒単位で指定します。nの初期値は30(待機時間30秒)です。
/reg /rおよび/wオプションで指定した値をレジストリのデフォルト設定として保存します。
/tbd 共有名が定義されるまでシステムが待機することを指定します(再試行エラー 67)。
[ログ オプション]
table:[ログ オプション]
オプション 説明
/l ファイルの一覧表示のみを行うことを指定します(コピー、削除、タイムスタンプは行いません)。
/x 選択されているものだけでなく、すべての余分なファイルを報告します。
/v 詳細出力を生成し、すべてのスキップしたファイルを示します。
/ts ソース ファイルのタイム スタンプを出力に含めます。
/fp 出力にはファイルの完全パス名が含まれます。
/bytes プリントサイズをバイト単位で表示します。
/ns ファイルのサイズを記録しないように指定します。
/nc ファイルクラスを記録しないことを指定します。
/nfl ファイル名をログに記録しないように指定します。
/ndl ディレクトリ名をログに記録しないように指定します。
/np コピー操作の進行状況 (それまでにコピーされたファイルまたはディレクトリの数) が表示されないように指定します。
/eta コピーしているファイルの完了 (予定) の推定時間を示します。
/log:<logfile> ステータスの出力をログファイルに書き込みます(既存のログファイルを上書きします)。
/log +:<logfile> ステータスの出力をログファイルに書き込みます(既存のログファイルに追加します)。
/unicode ステータス出力を Unicode テキストで表示します。
/unilog:<logfile> ステータス出力をUnicodeテキストでログファイルに書き込みます(既存のログファイルに上書きします)。
/unilog +:<logfile> ステータス出力をUnicodeテキストでログファイルに書き込みます(既存のログファイルに追加します)。
/tee ステータス出力をコンソールウィンドウとログファイルに書き込みます。
/njh ジョブのヘッダーがないことを指定します。
/njs ジョブの概要がないことを指定します。
ジョブのオプション
table:ジョブのオプション
オプション 説明
/job:<jobname> パラメーターをジョブの名前付きのファイルから派生するように指定します。
/save:<jobname> パラメーターを名前付きのジョブのファイルに保存するように指定します。
/quit (パラメーターを表示する) のコマンドラインの処理の後に終了します。
/nosd ソース ディレクトリが指定されていないことを示します。
/nodd インストール先ディレクトリが指定されていないことを示します。
/if 指定したファイルが含まれます。
終了 (リターン) コード
table: 終了 (リターン) コード
値 説明
0 ファイルはコピーされませんでした。 エラーは発生しませんでした。 一致するファイルがありませんでした。
ファイルは、コピー先のディレクトリに既に存在します。そのため、コピー操作はスキップされました。
1 すべてのファイルが正常にコピーされました。
2 コピー先のディレクトリには、ソースディレクトリに存在しない追加ファイルがいくつかあります。
ファイルはコピーされませんでした。
3 一部のファイルがコピーされました。 追加ファイルが存在しました。
エラーは発生しませんでした。
5 一部のファイルがコピーされました。 一部のファイルが一致しませんでした。
エラーは発生しませんでした。
6 追加のファイルと一致しないファイルが存在します。
ファイルがコピーされなかったため、エラーは発生しませんでした。
これは、ファイルがコピー先ディレクトリに既に存在することを意味します。
7 ファイルがコピーされ、ファイルの不一致が存在し、追加のファイルが存在しました。
8 いくつかのファイルがコピーされませんでした。
備考
8より大きい値は、コピー動作中に少なくとも1つの障害が発生したことを示します。
その他のリファレンス
コマンド ライン構文の記号
robocopy
03/17/2021
8 minutes to read
Copies file data from one location to another.
Syntax
For example, to copy a file named yearly-report.mov from c:\reports to a file share \\marketing\videos while enabling multi-threading for higher performance (with the /mt parameter) and the ability to restart the transfer in case it's interrupted (with the /z parameter), type:
dos
robocopy c:\reports '\\marketing\videos' yearly-report.mov /mt /z
Parameters
table:Parameters
Parameter Description
<source> Specifies the path to the source directory.
<destination> Specifies the path to the destination directory.
<file> Specifies the file or files to be copied.
Wildcard characters (* or ?) are supported.
If you don't specify this parameter, *.* is used as the default value.
<options> Specifies the options to use with the robocopy command,
including copy, file, retry, logging, and job options.
Copy options
table:Copy options
Option Description
/s Copies subdirectories. This option automatically excludes empty directories.
/e Copies subdirectories. This option automatically includes empty directories.
/lev:<n> Copies only the top n levels of the source directory tree.
/z Copies files in restartable mode. In restartable mode, should a file copy be interrupted,
Robocopy can pick up where it left off rather than re-copying the entire file.
/b Copies files in backup mode. Backup mode allows Robocopy to override file and folder permission
settings (ACLs).
This allows you to copy files you might otherwise not have access to, assuming it's being run
under an account with sufficient privileges.
/zb Copies files in restartable mode. If file access is denied, switches to backup mode.
/j Copies using unbuffered I/O (recommended for large files).
/efsraw Copies all encrypted files in EFS RAW mode.
/copy:<copyflags> Specifies which file properties to copy. The valid values for this option are:
D - Data
A - Attributes
T - Time stamps
S - NTFS access control list (ACL)
O - Owner information
U - Auditing information
The default value for this option is DAT (data, attributes, and time stamps).
/dcopy:<copyflags> Specifies what to copy in directories. The valid values for this option are:
D - Data
A - Attributes
T - Time stamps
The default value for this option is DA (data and attributes).
/sec Copies files with security (equivalent to /copy:DATS).
/copyall Copies all file information (equivalent to /copy:DATSOU).
/nocopy Copies no file information (useful with /purge).
/secfix Fixes file security on all files, even skipped ones.
/timfix Fixes file times on all files, even skipped ones.
/purge Deletes destination files and directories that no longer exist in the source.
Using this option with the /e option and a destination directory, allows the destination directory
security settings to not be overwritten.
/mir Mirrors a directory tree (equivalent to /e plus /purge).
Using this option with the /e option and a destination directory, overwrites the destination
directory security settings.
/mov Moves files, and deletes them from the source after they are copied.
/move Moves files and directories, and deletes them from the source after they are copied.
/a+:[RASHCNET] Adds the specified attributes to copied files. The valid values for this option are:
R - Read only
A - Archive
S - System
H - Hidden
C - Compressed
N - Not content indexed
E - Encrypted
T - Temporary
/a-:[RASHCNET] Removes the specified attributes from copied files. The valid values for this option are:
R - Read only
A - Archive
S - System
H - Hidden
C - Compressed
N - Not content indexed
E - Encrypted
T - Temporary
/create Creates a directory tree and zero-length files only.
/fat Creates destination files by using 8.3 character-length FAT file names only.
/256 Turns off support for paths longer than 256 characters.
/mon:<n> Monitors the source, and runs again when more than n changes are detected.
/mot:<m> Monitors the source, and runs again in m minutes, if changes are detected.
/MT[:n] Creates multi-threaded copies with n threads. n must be an integer between 1 and 128.
The default value for n is 8. For better performance, redirect your output using /log option.
The /mt parameter can't be used with the /ipg and /efsraw parameters.
/rh:hhmm-hhmm Specifies run times when new copies may be started.
/pf Checks run times on a per-file (not per-pass) basis.
/ipg:n Specifies the inter-packet gap to free bandwidth on slow lines.
/sl Don't follow symbolic links and instead create a copy of the link.
/nodcopy Copies no directory info (the default /dcopy:DA is done).
/nooffload Copies files without using the Windows Copy Offload mechanism.
/compress Requests network compression during file transfer, if applicable.
Important
When using the /secfix copy option, specify the type of security information you want to copy, using one of these additional copy options:
/copyall
/copy:o
/copy:s
/copy:u
/sec
File selection options
table:File selection options
Option Description
/a Copies only files for which the Archive attribute is set.
/m Copies only files for which the Archive attribute is set, and resets the Archive attribute.
/ia:[RASHCNETO] Includes only files for which any of the specified attributes are set.
The valid values for this option are:
R - Read only
A - Archive
S - System
H - Hidden
C - Compressed
N - Not content indexed
E - Encrypted
T - Temporary
O - Offline
/xa:[RASHCNETO] Excludes files for which any of the specified attributes are set.
The valid values for this option are:
R - Read only
A - Archive
S - System
H - Hidden
C - Compressed
N - Not content indexed
E - Encrypted
T - Temporary
O - Offline
/xf <filename>[ ...] Excludes files that match the specified names or paths. Wildcard characters (* and ?) are supported.
/xd <directory>[ ...] Excludes directories that match the specified names and paths.
/xc Excludes existing files with the same timestamp, but different file sizes.
/xn Excludes existing files newer than the copy in the source directory.
/xo Excludes existing files older than the copy in the source directory.
/xx Excludes extra files and directories present in the destination but not the source.
Excluding extra files will not delete files from the destination.
/xl Excludes "lonely" files and directories present in the source but not the destination.
Excluding lonely files prevents any new files from being added to the destination.
/is Includes the same files. Same files are identical in name, size, times, and all attributes.
/it Includes "tweaked" files.
Tweaked files have the same name, size, and times, but different attributes.
/max:<n> Specifies the maximum file size (to exclude files bigger than n bytes).
/min:<n> Specifies the minimum file size (to exclude files smaller than n bytes).
/maxage:<n> Specifies the maximum file age (to exclude files older than n days or date).
/minage:<n> Specifies the minimum file age (exclude files newer than n days or date).
/maxlad:<n> Specifies the maximum last access date (excludes files unused since n).
/minlad:<n> Specifies the minimum last access date (excludes files used since n)
If n is less than 1900, n specifies the number of days.
Otherwise, n specifies a date in the format YYYYMMDD.
/xj Excludes junction points, which are normally included by default.
/fft Assumes FAT file times (two-second precision).
/dst Compensates for one-hour DST time differences.
/xjd Excludes junction points for directories.
/xjf Excludes junction points for files.
Retry options
table:Retry options
Option Description
/r:<n> Specifies the number of retries on failed copies. The default value of n is 1,000,000 (one million retries).
/w:<n> Specifies the wait time between retries, in seconds. The default value of n is 30 (wait time 30 seconds).
/reg Saves the values specified in the /r and /w options as default settings in the registry.
/tbd Specifies that the system will wait for share names to be defined (retry error 67).
Logging options
table:Logging options
Option Description
/l Specifies that files are to be listed only (and not copied, deleted, or time stamped).
/x Reports all extra files, not just those that are selected.
/v Produces verbose output, and shows all skipped files.
/ts Includes source file time stamps in the output.
/fp Includes the full path names of the files in the output.
/bytes Prints sizes, as bytes.
/ns Specifies that file sizes are not to be logged.
/nc Specifies that file classes are not to be logged.
/nfl Specifies that file names are not to be logged.
/ndl Specifies that directory names are not to be logged.
/np Specifies that the progress of the copying operation (the number of files or directories copied so far) will not be displayed.
/eta Shows the estimated time of arrival (ETA) of the copied files.
/log:<logfile> Writes the status output to the log file (overwrites the existing log file).
/log+:<logfile> Writes the status output to the log file (appends the output to the existing log file).
/unicode Displays the status output as Unicode text.
/unilog:<logfile> Writes the status output to the log file as Unicode text (overwrites the existing log file).
/unilog+:<logfile> Writes the status output to the log file as Unicode text (appends the output to the existing log file).
/tee Writes the status output to the console window, as well as to the log file.
/njh Specifies that there is no job header.
/njs Specifies that there is no job summary.
Job options
table:Job options
Option Description
/job:<jobname> Specifies that parameters are to be derived from the named job file.
/save:<jobname> Specifies that parameters are to be saved to the named job file.
/quit Quits after processing command line (to view parameters).
/nosd Indicates that no source directory is specified.
/nodd Indicates that no destination directory is specified.
/if Includes the specified files.
Exit (return) codes
table:Exit (return) codes
Value Description
0 No files were copied. No failure was encountered. No files were mismatched. The files already exist in the destination directory; therefore, the copy operation was skipped.
1 All files were copied successfully.
2 There are some additional files in the destination directory that are not present in the source directory. No files were copied.
3 Some files were copied. Additional files were present. No failure was encountered.
5 Some files were copied. Some files were mismatched. No failure was encountered.
6 Additional files and mismatched files exist. No files were copied and no failures were encountered. This means that the files already exist in the destination directory.
7 Files were copied, a file mismatch was present, and additional files were present.
8 Several files did not copy.
Note
Any value greater than 8 indicates that there was at least one failure during the copy operation.
Additional References
Command-Line Syntax Key