RoboSharp Documentation
RoboSharp is a .NET wrapper for windows Robocopy utility. All the functionality of RoboSharp is rolled up neatly in the RoboCommand class.
RoboCommand Class
Properties
public string CommandOptions { set; get; } - Displays the currently applied Robocopy switches in a command (This is for informational purposes only).
public CopyOptions CopyOptions { set; get; } - Get or set the copy options for a command. This property is initialized to a default set of CopyOptions.
public bool IsPaused { get; } - Gets a value indicating if the command is paused or running.
public LoggingOptions LoggingOptions { set; get; } - Get or set the logging options for a command. This property is initialized to a default set of LoggingOptions.
public RetryOptions RetryOptions { set; get; } - Get or set the retry options for a command. This property is initialized to a default set of RetryOptions.
public SelectOptions SelectOptions { set; get; } - Get or set the select options for a command. This property is initialized to a default set of SelectOptions.
Methods
public void Dispose() - Disposes the RoboCommand along with any child processes.
public void Pause() - Pauses the RoboCommand which halts the copy operation.
public void Resume() - Resumes the RoboCommand which continues the copy operation.
public void Start() - Starts the RoboCommand.
public void Stop() - Stops the RoboCommand.
Events
public event OnCommandCompleted - Fired when the RoboCommand has completed all operations.
public event OnCommandError - Fired when an error occurs in the RoboCommand.
public event OnCopyProgressChanged - Fired when the progress of the current file copy changes.
public event OnError - Fired when an error occurs while performing an operation on a file.
public event OnFileProcessed - Fired when there is new information regarding a file being processed.
CopyOptions Class
Properties
public string AddAttributes { set; get; } - This property should be set to a string consisting of all the attributes to add (eg. AH; RASHCNET). Adds the specified attributes to copied files. [/A+:attributes]
public string CheckPerFile { set; get; } - Checks run times on a per-file (not per-pass) basis. [/PF]
public bool CopyAll { set; get; } - Copies all file information (equivalent to /copy:DATSOU). [/COPYALL]
public bool CopyFilesWithSecurity { set; get; } - Copies files with security (equivalent to /copy:DAT). [/SEC]
public string CopyFlags { set; get; } - This property should be set to a string consisting of all the flags to include (eg. DAT; DATSOU) Specifies the file properties to be copied. The following are the valid values for this option: D Data A Attributes
T Time stamps S NTFS access control list (ACL) O Owner information U Auditing information The default value for copyflags is DA (data, attributes, and time stamps). [/COPY:copyflags]
public bool CopySubdirectories { set; get; } - Copies subdirectories. Note that this option excludes empty directories. [/S]
public bool CopySubdirectoriesIncludingEmpty { set; get; } - Copies subdirectories. Note that this option includes empty directories. [/E]
public bool CopySymbolicLink { set; get; } - Copies the symbolic link instead of the target. [/SL]
public bool CreateDirectoryAndFileTree { set; get; } - Creates a directory tree and zero-length files only. [/CREATE]
public int Depth { set; get; } - Copies only the top N levels of the source directory tree. The default is zero which does not limit the depth. [/LEV:N]
public string Destination { set; get; } - The destination file path where the RoboCommand is copying files to.
public string DirectoryCopyFlags { set; get; } - What to copy for directories (default is DA). (copyflags: D=Data, A=Attributes, T=Timestamps). [/DCOPY:copyflags]
public bool DoNotCopyDirectoryInfo { set; get; } - Do not copy any directory info. [/NODCOPY]
public bool DoNotUseWindowsCopyOffload { set; get; } - Copy files without using the Windows Copy Offload mechanism. [/NOOFFLOAD]
public bool EnableBackupMode { set; get; } - Copies files in Backup mode. [/B]
public bool EnableEfsRawMode { set; get; } - Copies all encrypted files in EFS RAW mode. [/EFSRAW]
public bool EnableRestartMode { set; get; } - Copies files in Restart mode. [/Z]
public bool EnableRestartModeWithBackupFallback { set; get; } - Uses Restart mode. If access is denied, this option uses Backup mode. [/ZB]
public bool FatFiles { set; get; } - Creates destination files by using 8.3 character-length FAT file names only. [/FAT]
public string FileFilter { set; get; } - Allows you to supply a specific file to copy or use wildcard characters (* or ?).
public bool FixFileSecurityOnAllFiles { set; get; } - Fixes file security on all files, even skipped ones. [/SECFIX]
public bool FixFileTimesOnAllFiles { set; get; } - Fixes file times on all files, even skipped ones. [/TIMFIX]
public int InterPacketGap { set; get; } - The default value of zero indicates that this feature is turned off. Specifies the inter-packet gap to free bandwidth on slow lines. [/IPG:N]
public bool Mirror { set; get; } - Mirrors a directory tree (equivalent to CopySubdirectoriesIncludingEmpty plus Purge). [/MIR]
public int MonitorSourceChangesLimit { set; get; } - The default value of zero indicates that you do not wish to monitor for changes. Monitors the source, and runs again when more than N changes are detected. [/MON:N]
public int MonitorSourceTimeLimit { set; get; } - The default value of zero indicates that you do not wish to monitor for changes. Monitors source, and runs again in M minutes if changes are detected. [/MOT:M]
public bool MoveFiles { set; get; } - Moves files, and deletes them from the source after they are copied. [/MOV]
public bool MoveFilesAndDirectories { set; get; } - Moves files and directories, and deletes them from the source after they are copied. [/MOVE]
public int MultiThreadedCopiesCount { set; get; } - The default value of zero indicates that this feature is turned off. Creates multi-threaded copies with N threads. Must be an integer between 1 and 128. The MultiThreadedCopiesCount parameter
cannot be used with the /IPG and EnableEfsRawMode parameters. [/MT:N] (There is a known issue with inconsistent output when using this switch)
public bool Purge { set; get; } - Deletes destination files and directories that no longer exist in the source. [/PURGE]
public string RemoveAttributes { set; get; } - This property should be set to a string consisting of all the attributes to remove (eg. AH; RASHCNET). Adds the specified attributes to copied files. [/A-:attributes]
public bool RemoveFileInformation { set; get; } - Copies no file information (useful with Purge option). [/NOCOPY]
public string RunHours { set; get; } - Specifies run times when new copies may be started. [/rh:hhmm-hhmm]
public string Source { set; get; } - The source file path where the RoboCommand is copying files from.
public bool TurnLongPathSupportOff { set; get; } - Turns off support for very long paths (longer than 256 characters). [/256]
public bool UseUnbufferedIo { set; get; } - Copy using unbuffered I/O (recommended for large files). [/J]
SelectOptions Class
Properties
public bool CompensateForDstDifference { set; get; } - Compensates for one-hour DST time differences. [/DST]
public string ExcludeAttributes { set; get; } - This property should be set to a string consisting of all the attributes to exclude (eg. AH; RASHCNETO). Excludes files for which any of the specified attributes are set. [/XA:attributes]
public bool ExcludeChanged { set; get; } - Excludes changed files. [/XC]
public string ExcludeDirectories { set; get; } - Directories should be separated by spaces. Excludes directories that match the specified names or paths. [/XD Directory Directory ...]
public bool ExcludeExtra { set; get; } - Excludes extra files and directories. [/XX]
public string ExcludeFiles { set; get; } - Files should be separated by spaces. Excludes files that match the specified names or paths. Note that FileName can include wildcard characters (* and ?). [/XF File File ...]
public bool ExcludeJunctionPoints { set; get; } - Excludes junction points, which are normally included by default. [/XJ]
public bool ExcludeJunctionPointsForDirectories { set; get; } - Excludes junction points for directories. [/XJD]
public bool ExcludeJunctionPointsForFiles { set; get; } - Excludes junction points for files. [/XJF]
public bool ExcludeLonely { set; get; } - Excludes lonely files and directories. [/XL]
public bool ExcludeNewer { set; get; } - Excludes newer files. [/XN]
public bool ExcludeOlder { set; get; } - Excludes older files. [/XO]
public string IncludeAttributes { set; get; } - This property should be set to a string consisting of all the attributes to include (eg. AH; RASHCNETO). Includes only files for which any of the specified attributes are set. [/IA:attributes]
public bool IncludeSame { set; get; } - Includes the same files. [/IS]
public bool IncludeTweaked { set; get; } - Includes tweaked files. [/IT]
public string MaxFileAge { set; get; } - Specifies the maximum file age (to exclude files older than N days or date). [/MAXAGE:N OR YYYYMMDD]
public long MaxFileSize { set; get; } - Zero indicates that this feature is turned off. Specifies the maximum file size (to exclude files bigger than N bytes). [/MAX:N]
public string MaxLastAccessDate { set; get; } - Specifies the maximum last access date (excludes files unused since Date). [/MAXLAD:YYYYMMDD]
public string MinFileAge { set; get; } - Specifies the minimum file age (exclude files newer than N days or date). [/MINAGE:N OR YYYYMMDD]
public long MinFileSize { set; get; } - Zero indicates that this feature is turned off. Specifies the minimum file size (to exclude files smaller than N bytes). [/MIN:N]
public string MinLastAccessDate { set; get; } - 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. [/MAXLAD:N or YYYYMMDD]
public bool OnlyCopyArchiveFiles { set; get; } - Copies only files for which the Archive attribute is set. [/A]
public bool OnlyCopyArchiveFilesAndResetArchiveFlag { set; get; } - Copies only files for which the Archive attribute is set, and resets the Archive attribute. [/M]
public bool UseFatFileTimes { set; get; } - Assumes FAT file times (two-second precision). [/FFT]
RetryOptions Class
Properties
public int RetryCount { set; get; } - Specifies the number of retries N on failed copies (default is 0). [/R:N]
public int RetryWaitTime { set; get; } - Specifies the wait time N in seconds between retries (default is 30). [/W:N]
public bool SaveToRegistry { set; get; } - Saves RetryCount and RetryWaitTime in the Registry as default settings. [/REG]
public bool WaitForSharenames { set; get; } - Wait for sharenames to be defined. [/TBD]
LoggingOptions Class
Properties
public string AppendLogPath { set; get; } - Output status to LOG file (append to existing log). [/LOG+:file]
public string AppendUnicodeLogPath { set; get; } - Output status to LOG file as UNICODE (append to existing log). [/UNILOG+:file]
public bool IncludeFullPathNames { set; get; } - Include full path names of files in the output. [/FP]
public bool IncludeSourceTimeStamps { set; get; } - Include source file time stamps in the output. [/TS]
public bool ListOnly { set; get; } - Do not copy, timestamp or delete any files. [/L]
public string LogPath { set; get; } - Output status to LOG file (overwrite existing log). [/LOG:file]
public bool NoDirectoryList { set; get; } - Do not log directory names. [/NDL]
public bool NoFileClasses { set; get; } - Do not log file classes. [/NC]
public bool NoFileList { set; get; } - Do not log file names. [/NFL]
public bool NoFileSizes { set; get; } - Do not log file sizes. [/NS]
public bool NoJobHeader { set; get; } - Do not output a Job Header. [/NJH]
public bool NoJobSummary { set; get; } - Do not output a Job Summary. [/NJS]
public bool NoProgress { set; get; } - Do not log percentage copied. [/NP]
public bool OutputAsUnicode { set; get; } - Output as UNICODE. [/UNICODE]
public bool OutputToRoboSharpAndLog { set; get; } - Output to RoboSharp and Log. [/TEE]
public bool PrintSizesAsBytes { set; get; } - Print sizes as bytes in the output. [/BYTES]
public bool ReportExtraFiles { set; get; } - Report all extra files, not just those selected. [X]
public bool ShowEstimatedTimeOfArrival { set; get; } - Show estimated time of arrival of copied files. [/ETA]
public string UnicodeLogPath { set; get; } - Output status to LOG file as UNICODE (overwrite existing log). [/UNILOG:file]
public bool VerboseOutput { set; get; } - Produce verbose output, showing skipped files. [V]
ProcessedFileInfo Class
Properties
public string FileClass { set; get; } - The file class for the operation (New File, archive, lonely, etc.).
public string Name { set; get; } - The name of the file or directory being copied in the operation.
public long Size { set; get; } - The size of the file or the number of files in a directory.