Advertisement
Lee_Dailey

Robocopy_-_Demo_and_FullParameterList

Jul 29th, 2019 (edited)
799
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #region = Robocopy parameter list
  2. <#
  3. robocopy version 5.1.10.1027 [win7x64, sp1]
  4.  
  5.              Usage :: ROBOCOPY source destination [file [file]...] [options]
  6.  
  7.             source :: Source Directory (drive:\path or \\server\share\path).
  8.        destination :: Destination Dir  (drive:\path or \\server\share\path).
  9.               file :: File(s) to copy  (names/wildcards: default is "*.*").
  10.  
  11. ::
  12. :: Copy options :
  13. ::
  14.                 /S :: copy Subdirectories, but not empty ones.
  15.                 /E :: copy subdirectories, including Empty ones.
  16.             /LEV:n :: only copy the top n LEVels of the source directory tree.
  17.  
  18.                 /Z :: copy files in restartable mode.
  19.                 /B :: copy files in Backup mode.
  20.                /ZB :: use restartable mode; if access denied use Backup mode.
  21.            /EFSRAW :: copy all encrypted files in EFS RAW mode.
  22.  
  23.  /COPY:copyflag[s] :: what to COPY for files (default is /COPY:DAT).
  24.                     (copyflags : D=Data, A=Attributes, T=Timestamps).
  25.                     (S=Security=NTFS ACLs, O=Owner info, U=aUditing info).
  26.  
  27.           /DCOPY:T :: COPY Directory Timestamps.
  28.  
  29.               /SEC :: copy files with SECurity (equivalent to /COPY:DATS).
  30.           /COPYALL :: COPY ALL file info (equivalent to /COPY:DATSOU).
  31.            /NOCOPY :: COPY NO file info (useful with /PURGE).
  32.  
  33.            /SECFIX :: FIX file SECurity on all files, even skipped files.
  34.            /TIMFIX :: FIX file TIMes on all files, even skipped files.
  35.  
  36.             /PURGE :: delete dest files/dirs that no longer exist in source.
  37.               /MIR :: MIRror a directory tree (equivalent to /E plus /PURGE).
  38.  
  39.               /MOV :: MOVe files (delete from source after copying).
  40.              /MOVE :: MOVE files AND dirs (delete from source after copying).
  41.  
  42.     /A+:[RASHCNET] :: add the given Attributes to copied files.
  43.     /A-:[RASHCNET] :: remove the given Attributes from copied files.
  44.  
  45.            /CREATE :: CREATE directory tree and zero-length files only.
  46.               /FAT :: create destination files using 8.3 FAT file names only.
  47.               /256 :: turn off very long path (> 256 characters) support.
  48.  
  49.             /MON:n :: MONitor source; run again when more than n changes seen.
  50.             /MOT:m :: MOnitor source; run again in m minutes Time, if changed.
  51.  
  52.      /RH:hhmm-hhmm :: Run Hours - times when new copies may be started.
  53.                /PF :: check run hours on a Per File (not per pass) basis.
  54.  
  55.             /IPG:n :: Inter-Packet Gap (ms), to free bandwidth on slow lines.
  56.  
  57.                /SL :: copy symbolic links versus the target.
  58.  
  59.            /MT[:n] :: Do multi-threaded copies with n threads (default 8).
  60.                     n must be at least 1 and not greater than 128.
  61.                     This option is incompatible with the /IPG and /EFSRAW options.
  62.                     Redirect output using /LOG option for better performance.
  63.  
  64. ::
  65. :: File Selection Options :
  66. ::
  67.                 /A :: copy only files with the Archive attribute set.
  68.                 /M :: copy only files with the Archive attribute and reset it.
  69.    /IA:[RASHCNETO] :: Include only files with any of the given Attributes set.
  70.    /XA:[RASHCNETO] :: eXclude files with any of the given Attributes set.
  71.  
  72. /XF file [file]... :: eXclude Files matching given names/paths/wildcards.
  73. /XD dirs [dirs]... :: eXclude Directories matching given names/paths.
  74.  
  75.                /XC :: eXclude Changed files.
  76.                /XN :: eXclude Newer files.
  77.                /XO :: eXclude Older files.
  78.                /XX :: eXclude eXtra files and directories.
  79.                /XL :: eXclude Lonely files and directories.
  80.                /IS :: Include Same files.
  81.                /IT :: Include Tweaked files.
  82.  
  83.             /MAX:n :: MAXimum file size - exclude files bigger than n bytes.
  84.             /MIN:n :: MINimum file size - exclude files smaller than n bytes.
  85.  
  86.          /MAXAGE:n :: MAXimum file AGE - exclude files older than n days/date.
  87.          /MINAGE:n :: MINimum file AGE - exclude files newer than n days/date.
  88.          /MAXLAD:n :: MAXimum Last Access Date - exclude files unused since n.
  89.          /MINLAD:n :: MINimum Last Access Date - exclude files used since n.
  90.                     (If n < 1900 then n = n days, else n = YYYYMMDD date).
  91.  
  92.                /XJ :: eXclude Junction points. (normally included by default).
  93.  
  94.               /FFT :: assume FAT File Times (2-second granularity).
  95.               /DST :: compensate for one-hour DST time differences.
  96.  
  97.               /XJD :: eXclude Junction points for Directories.
  98.               /XJF :: eXclude Junction points for Files.
  99.  
  100. ::
  101. :: Retry Options :
  102. ::
  103.               /R:n :: number of Retries on failed copies: default 1 million.
  104.               /W:n :: Wait time between retries: default is 30 seconds.
  105.  
  106.               /REG :: Save /R:n and /W:n in the Registry as default settings.
  107.  
  108.               /TBD :: wait for sharenames To Be Defined (retry error 67).
  109.  
  110. ::
  111. :: Logging Options :
  112. ::
  113.                 /L :: List only - don't copy, timestamp or delete any files.
  114.                 /X :: report all eXtra files, not just those selected.
  115.                 /V :: produce Verbose output, showing skipped files.
  116.                /TS :: include source file Time Stamps in the output.
  117.                /FP :: include Full Pathname of files in the output.
  118.             /BYTES :: Print sizes as bytes.
  119.  
  120.                /NS :: No Size - don't log file sizes.
  121.                /NC :: No Class - don't log file classes.
  122.               /NFL :: No File List - don't log file names.
  123.               /NDL :: No Directory List - don't log directory names.
  124.  
  125.                /NP :: No Progress - don't display percentage copied.
  126.               /ETA :: show Estimated Time of Arrival of copied files.
  127.  
  128.          /LOG:file :: output status to LOG file (overwrite existing log).
  129.         /LOG+:file :: output status to LOG file (append to existing log).
  130.  
  131.       /UNILOG:file :: output status to LOG file as UNICODE (overwrite existing log).
  132.      /UNILOG+:file :: output status to LOG file as UNICODE (append to existing log).
  133.  
  134.               /TEE :: output to console window, as well as the log file.
  135.  
  136.               /NJH :: No Job Header.
  137.               /NJS :: No Job Summary.
  138.  
  139.           /UNICODE :: output status as UNICODE.
  140.  
  141. ::
  142. :: Job Options :
  143. ::
  144.       /JOB:jobname :: take parameters from the named JOB file.
  145.      /SAVE:jobname :: SAVE parameters to the named job file
  146.              /QUIT :: QUIT after processing command line (to view parameters).
  147.              /NOSD :: NO Source Directory is specified.
  148.              /NODD :: NO Destination Directory is specified.
  149.                /IF :: Include the following Files.
  150. #>
  151. #endregion = Robocopy parameter list
  152.  
  153. $SourceComputerName = $env:COMPUTERNAME
  154. $Source = "\\$SourceComputerName\c$\Temp\zzz - copy"
  155.    
  156. $DestComputerName = $env:COMPUTERNAME
  157. $Destination = "\\$DestComputerName\d$\Temp\aaa"
  158.    
  159. $FileSpec = '*.*'
  160.    
  161. $TimeStamp = Get-Date -Format 'yyyy-MM-dd_hh-mm-ss'
  162. $Subject = 'RobocopyTest'
  163. $LogFileName = -join ($Subject, '_-_', $TimeStamp, '.log')
  164. $FullLogFileName = Join-Path -Path $env:TEMP -ChildPath $LogFileName
  165.  
  166. $RC_Params = @(
  167.     $Source
  168.     $Destination
  169.     $FileSpec
  170.     # put your current options below
  171.     "/Log:$FullLogFileName"
  172.     '/NP'
  173.     '/E'
  174.     '/TEE'
  175.     )
  176.  
  177. $RC_Params
  178. #robocopy $RC_Params
  179.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement