Skip to content

Instantly share code, notes, and snippets.

@ccurtin
Last active August 29, 2015 14:10
Show Gist options
  • Save ccurtin/3567a2e79117deb23237 to your computer and use it in GitHub Desktop.
Save ccurtin/3567a2e79117deb23237 to your computer and use it in GitHub Desktop.
COPY source->destination
XCOPY X:\path\source\*.* X:\path\to\destination /D/S/H/V/C/F/K/Y
robocopy ./path/to/src/ ./path/to/dest/ -E

Robocopy Syntax

ROBOCOPY source destination [file [file]…] [options] where source is Source Directory (drive:\path or \server\share\path), destination is Destination Directory (drive:\path or \server\share\path) and file is File(s) to copy where names or wildcards can be specified and default is “.” (all files).

Robocopy Options and Switches

*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. /EFSRAW :: copy all encrypted files in EFS RAW mode. /COPY:copyflag[s] :: what to COPY for files (default is /COPY:DAT). (copyflags : D=Data, A=Attributes, T=Timestamps). (S=Security=NTFS ACLs, O=Owner info, U=aUditing info). /DCOPY:T :: COPY Directory Timestamps. /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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment