RoboSharp
Source, Destination, and options for how to move or copy files.
Create new CopyOptions with Default Settings
Create a new CopyOptions object with the provided settings
Clone a CopyOptions Object
CopyOptions object to clone
Specify a new source if desired. If left as null, will use Source from
Specify a new source if desired. If left as null, will use Destination from
The Default File Filter used that will allow copying of all files
The source file path where the RoboCommand is copying files from.
The destination file path where the RoboCommand is copying files to.
Allows you to supply a set of files to copy or use wildcard characters (* or ?).
JobOptions file saves these into the /IF (Include Files) section
Copies subdirectories. Note that this option excludes empty directories.
[/S]
Copies subdirectories. Note that this option includes empty directories.
[/E]
Copies only the top N levels of the source directory tree. The default is
zero which does not limit the depth.
[/LEV:N]
Copies files in Restart mode.
[/Z]
Copies files in Backup mode.
[/B]
Uses Restart mode. If access is denied, this option uses Backup mode.
[/ZB]
Copy using unbuffered I/O (recommended for large files).
[/J]
Copies all encrypted files in EFS RAW mode.
[/EFSRAW]
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 DAT (data, attributes, and time stamps).
[/COPY:copyflags]
Copies files with security (equivalent to /copy:DAT).
[/SEC]
Copies all file information (equivalent to /copy:DATSOU).
[/COPYALL]
Copies no file information (useful with Purge option).
[/NOCOPY]
Fixes file security on all files, even skipped ones.
[/SECFIX]
Fixes file times on all files, even skipped ones.
[/TIMFIX]
Deletes destination files and directories that no longer exist in the source.
[/PURGE]
Mirrors a directory tree (equivalent to CopySubdirectoriesIncludingEmpty plus Purge).
[/MIR]
Moves files, and deletes them from the source after they are copied.
[/MOV]
Moves files and directories, and deletes them from the source after they are copied.
[/MOVE]
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]
This property should be set to a string consisting of all the attributes to remove (eg. AH; RASHCNET).
Removes the specified attributes from copied files.
[/A-:attributes]
Creates a directory tree and zero-length files only.
[/CREATE]
Creates destination files by using 8.3 character-length FAT file names only.
[/FAT]
Turns off support for very long paths (longer than 256 characters).
[/256]
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]
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]
Specifies run times when new copies may be started. ( Copy Operation is scheduled to only operate within specified timeframe )
[/rh:hhmm-hhmm]
If copy operation is unfinished, robocopy will remain active in idle state until the specified time, at which it will resume copying.
Must be in correct format. Incorrectly formatted strings will be ignored.
Examples:
1500-1800 -> Robocopy will only copy between 3 PM and 5 PM
0015-0530 -> Robocopy will only copy between 12:15 AM and 5:30 AM
If this is set up, then the robocopy process will remain active after the program exits if the calling asemmbly does not call prior to exiting the application.
Checks the scheduled /RH (run hours) per file instead of per pass.
[/PF]
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]
Copies the symbolic link instead of the target.
[/SL]
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]
What to copy for directories (default is DA).
(copyflags: D=Data, A=Attributes, T=Timestamps).
[/DCOPY:copyflags]
Do not copy any directory info.
[/NODCOPY]
Copy files without using the Windows Copy Offload mechanism.
[/NOOFFLOAD]
Used by the Parse method to sanitize path for the command options.
Evaluate the path. If needed, wrap it in quotes.
If the path ends in a DirectorySeperatorChar, santize it to work as expected.
Each return string includes a space at the end of the string to seperate it from the next option variable.
Parse the class properties and generate the command arguments
Get the StartTime portion of
hhmm or String.Empty
Get the EndTime portion of
hhmm or String.Empty
Method to check if some string is valid for use as with the property.
True if correct format, otherwise false
Enum to define the high-level copy action to be taken by RoboCopy process.
Default Functionality is to only copy the files within the source directory - does not copy any files within the subfolders.
Apply the to the command
Options to apply
Get the representation of this object
Combine this object with another CopyOptions object.
Any properties marked as true take priority. IEnumerable items are combined.
Source and Destination are only taken from the merged item if this object's Source/Destination values are null/empty.
RunHours follows the same rules.
This is the Default Configuration class to use
Describes an error that occured when generating the command
Error Description
If this CommandErrorEventArgs object was created in response to an exception, that exception is captured here.
If no exception was thrown, this property will be null.
Exception to data to pass to the event handler
Current File Progress reported as
Current File Progress Percentage
Contains information about the Last Directory RoboCopy reported into the log.
Information about an Error reported by the RoboCopy process
Error Code
Error Description
Error Code
Signed Error Code
The File or Directory Path the Error refers to
DateTime the error occurred
Concatenate the and into a string seperated by an
Regex used to split the Error Code into its various parts.
Must have the following groups: Date, ErrCode, SignedErrCode, Descrip, Path
Event Args provided by IProgressEstimator objects to notify the UI it should refresh the stat values
Dummy Args with Values of 0 to perform final updates through ProgressEstimator without creating new args every time
IStatistic Object that shows how much was added to the { } object during this UI Update
IStatistic Object that shows how much was added to the { } object during this UI Update
IStatistic Object that shows how much was added to the { } object during this UI Update
Reports that a ProgressEstimator object is now available for binding
EventArgs for the delegate
Create the EventArgs for the delegate
Results list to present as an interface
Read-Only interface to the List that has been updated.
EventArgs to declare when a RoboCommand process starts
Command that started.
Returns TRUE if the command's is available for binding
Local time the command started.
EventArgs to declare when a RoboCommand process starts
RoboQueue Results Object
TRUE if this run was a COPY OPERATION, FALSE is the results were created after a call.
Interface helper for dealing with Statistic Event Args
TRUE if of type . Otherwise false.
TRUE if of type . Otherwise false.
EventArgs provided by when any individual property gets modified.
Under most circumstances, the 'PropertyName' property will detail which parameter has been updated.
When the Statistic object has multiple values change via a method call ( Reset / Add / Subtract methods ), then PropertyName will be String.Empty, indicating multiple values have changed.
If this is the case, then the , , and will report the value from the sender's property.
This is a reference to the Statistic that generated the EventArg object
Old Value of the object
Current Value of the object
Result of NewValue - OldValue
EventArgs provided by
Under most circumstances, the 'PropertyName' property will detail which parameter has been updated.
When the Statistic object has multiple values change via a method call ( Reset / Add / Subtract methods ), then PropertyName will be String.Empty, indicating multiple values have changed.
If this is the case, then the , , and will report the value from the sender's property.
Old Value of the object
Current Value of the object
Result of NewValue - OldValue
Provide a base class that includes a StartTime, EndTime and will calculate the TimeSpan in between
Create New Args
Local time the command started.
Local time the command stopped.
Length of time the process took to run
Return the Results object
Encase the LogPath in quotes if needed
Extension method provided by RoboSharp package
Check if the string ends with a directory seperator character
Convert into a char[]. Perform a ForEach( Char in strTwo) loop, and append any characters in Str2 to the end of this string if they don't already exist within this string.
Compare the current value to that of the supplied value, and take the greater of the two.
Evaluate this string. If this string is null or empty, replace it with the supplied string.
Object that provides objects whose events can be bound to report estimated RoboCommand / RoboQueue progress periodically.
Estimate of current number of directories processed while the job is still running.
Estimate is provided by parsing of the LogLines produces by RoboCopy.
Estimate of current number of files processed while the job is still running.
Estimate is provided by parsing of the LogLines produces by RoboCopy.
Estimate of current number of bytes processed while the job is still running.
Estimate is provided by parsing of the LogLines produces by RoboCopy.
Parse this object's stats into a enum.
Event that occurs when this IProgressEstimatorObject's IStatistic values have been updated.
Provides objects for File, Directory, and Bytes to allow comparison between ProgressEstimator and RoboCopyResults objects
Information about number of Directories Copied, Skipped, Failed, etc.
Information about number of Files Copied, Skipped, Failed, etc.
Information about number of Bytes processed.
Interface for a class factory object to produce objects
Usable by consumers to specify a factory object their library can rely on to create classes derived from the object.
Create a new object using the parameterless constructor
new object
Create a new with the specified source and destination
Read-Only interface for
Interface to provide Read-Only access to a
Implements:
where T =
Get the objects at the specified index.
Get a snapshot of the ByteStatistics objects from this list.
New array of the ByteStatistic objects
Get a snapshot of the DirectoriesStatistic objects from this list.
New array of the DirectoriesStatistic objects
Get a snapshot of the FilesStatistic objects from this list.
New array of the FilesStatistic objects
Get a snapshot of the FilesStatistic objects from this list.
New array of the FilesStatistic objects
Get a snapshot of the FilesStatistic objects from this list.
New array of the FilesStatistic objects
Combine the into a single array of errors
New array of the ErrorEventArgs objects
Interface for RoboQueue
Interface for the object.
Implements
Local time the command started.
Local time the command stopped.
Length of time the process took to run
Provide Read-Only access to a SpeedStatistic
Average Transfer Rate in Bytes/Second
Average Transfer Rate in MB/Minute
new object
Provide Read-Only access to a object
Name of the Statistics Object
Total Scanned during the run
Total Copied
Total Skipped
Total that failed to copy or move
Total Extra that exist in the Destination (but are missing from the Source)
Occurs when the Property is updated.
Occurs when the Property is updated.
Occurs when the Property is updated.
Occurs when the Property is updated.
Occurs when the Property is updated.
Occurs when the Property is updated.
new object
Interface to normalize all the Start/End/TimeSpan properties of various objects
Local time the command started.
Local time the command stopped.
Length of time the process took to run
Represents a single RoboCopy Job File
Implements:
Create a JobFile with Default Options
Constructor for ICloneable Interface
Clone the RoboCommand's options objects into a new JobFile
RoboCommand whose options shall be cloned
Optional FilePath to specify for future call to
Constructor for Factory Methods
Create a clone of this JobFile
Expected File Extension for Job Files exported from RoboCopy.
FileFilter to use in an to search for this extension, such as with
FileFilter to use in a dialog window, such as the OpenFileDialog window.
Options are stored in a RoboCommand object for simplicity.
FilePath of the Job File
Update the property and save the JobFile to the
Update the property, then save the JobFile to this path.
Save the JobFile to .
Source and Destination will be included by default.
If path is null/empty, will throw
Task that completes when the JobFile has been saved.
Any comments within the job file lines will start with this string
Pattern to Identify the SWITCH, DELIMITER and VALUE section
Pattern to Identify the SWITCH, DELIMIETER and VALUE section
Pattern to Identify COMMENT sections - Throws out white space and comment delimiter '::'
Regex to check if an entire line is a comment
Captured Group Names:
COMMENT
Regex to check if the string is a flag for RoboCopy - These typically will have comments
Captured Group Names:
SWITCH
DELIMITER
VALUE
COMMENT
JobName for ROboCommand is not valid parameter for RoboCopy, so we save it into a comment within the file
Captured Group Names:
FLAG
NAME
COMMENT
Regex used for parsing File and Directory filters for /IF /XD and /XF flags
Captured Group Names:
PATH
COMMENT
Regex to find the SourceDirectory within the JobFile
Captured Group Names:
SWITCH
PATH
COMMENT
Regex to find the DestinationDirectory within the JobFile
Captured Group Names:
SWITCH
PATH
COMMENT
Regex to determine if on the INCLUDE FILES section of the JobFile
Each new path / filename should be on its own line
Regex to determine if on the EXCLUDE FILES section of the JobFile
Each new path / filename should be on its own line
Regex to determine if on the EXCLUDE DIRECTORIES section of the JobFile
Each new path / filename should be on its own line
Read each line using and attempt to produce a Job File.
If FileExtension != ".RCJ" -> returns null. Otherwise parses the file.
FileInfo object for some Job File. File Path should end in .RCJ
Use to read all lines from the supplied file path.
If FileExtension != ".RCJ" -> returns null. Otherwise parses the file.
File Path to some Job File. File Path should end in .RCJ
Read each line from a StreamReader and attempt to produce a Job File.
StreamReader for a file stream that represents a Job File
Parse each line in , and attempt to create a new JobFile object.
String[] read from a JobFile
Parser to create CopyOptions object for JobFiles
Parser to create SelectionOptions object for JobFiles
Parser to create LoggingOptions object for JobFiles
Parser to create JobOptions object for JobFiles
Constructor for ICloneable Interface
JobOptions object to clone
Clone this JobOptions object
New JobOptions object
Take parameters from the named job file
Usage: /JOB:"Path\To\File.RCJ"
Save parameters to the named job file
Usage:
/SAVE:"Path\To\File" -> Creates Path\To\File.RCJ
/SAVE:"Path\To\File.txt" -> Creates Path\To\File.txt.RCJ
Quit after processing command line
Used when writing JobFile
No source directory is specified
No destination directory is specified
FilePath to save the Job Options (.RCJ) file to.
/SAVE:{FilePath}
This causes RoboCopy to generate an RCJ file where the command options are stored to so it can be used later.
and options are only evaluated if this is set.
RoboCopy will validate the command, then exit before performing any Move/Copy/List operations.
/QUIT
This option is typically used when generating JobFiles. RoboCopy will exit after saving the Job FIle to the specified
path will not be saved to the JobFile.
/NOSD
Default value is False, meaning if is set, it will be saved to the JobFile RoboCopy generates.
path will not be saved to the JobFile.
/NODD
Default value is False, meaning if is set, it will be saved to the JobFile RoboCopy generates.
Parse the properties and return the string
Adds the 'NAME' and other properties into the JobFile
Combine this object with another RetryOptions object.
not not be modified.
Options related to the output logs generated by RoboCopy
Create new LoggingOptions with Default Settings
Clone a LoggingOptions Object
LoggingOptions object to clone
Do not copy, timestamp or delete any files.
[/L]
Report all extra files, not just those selected.
[X]
Produce verbose output, showing skipped files.
[V]
Include source file time stamps in the output.
[/TS]
Include full path names of files in the output.
[/FP]
Print sizes as bytes in the output.
[/BYTES]
Do not log file sizes.
[/NS]
Do not log file classes.
[/NC]
Do not log file names.
[/NFL]
WARNING: If this is set to TRUE then GUI cannot handle showing progress correctly as it can't get information it requires from the log
Do not log directory names.
[/NDL]
Do not log percentage copied.
[/NP]
Show estimated time of arrival of copied files.
[/ETA]
Output status to LOG file (overwrite existing log).
[/LOG:file]
Output status to LOG file (append to existing log).
[/LOG+:file]
Output status to LOG file as UNICODE (overwrite existing log).
[/UNILOG:file]
Output status to LOG file as UNICODE (append to existing log).
[/UNILOG+:file]
Output to RoboSharp and Log.
[/TEE]
Do not output a Job Header.
[/NJH]
Do not output a Job Summary.
[/NJS]
WARNING: If this is set to TRUE then statistics will not work correctly as this information is gathered from the job summary part of the log
Output as UNICODE.
[/UNICODE]
Encase the LogPath in quotes if needed
Combine this object with another LoggingOptions object.
Any properties marked as true take priority. IEnumerable items are combined.
String Values will only be replaced if the primary object has a null/empty value for that property.
Native Methods for Pause/Suspend/Resume processes
Object derived from TaskScheduler. Assisgns the task to some thread
TaskScheduler for AboveNormal Priority Tasks
TaskScheduler for BelowNormal Priority Tasks
TaskScheduler for the lowest Priority Tasks
Message Type reported by RoboCopy
Details about a Directory
Details about a FILE
Status Message reported by RoboCopy
Contains information about the current item being processed by RoboCopy
Description of the item as reported by RoboCopy
File -> File Size
Directory -> Number files in folder -> Can be negative if PURGE is used
SystemMessage -> Should be 0
Folder or File Name / Message Text
Object that provides objects whose events can be bound to report estimated RoboCommand progress periodically.
Note: Only works properly with /V verbose set TRUE.
Subscribe to or to be notified when the ProgressEstimator becomes available for binding
Create event handler to subscribe to the Events you want to handle:
private void OnProgressEstimatorCreated(object sender, Results.ProgressEstimatorCreatedEventArgs e) {
e.ResultsEstimate.ByteStats.PropertyChanged += ByteStats_PropertyChanged;
e.ResultsEstimate.DirStats.PropertyChanged += DirStats_PropertyChanged;
e.ResultsEstimate.FileStats.PropertyChanged += FileStats_PropertyChanged;
}
Used for providing Source Directory in CopyProgressChanged args
Used for providing Source Directory in CopyProgressChanged args AND for byte Statistic
Marked as TRUE if this is LIST ONLY mode or the file is 0KB -- Value set during 'AddFile' method
Estimate of current number of directories processed while the job is still running.
Estimate is provided by parsing of the LogLines produces by RoboCopy.
Estimate of current number of files processed while the job is still running.
Estimate is provided by parsing of the LogLines produces by RoboCopy.
Estimate of current number of bytes processed while the job is still running.
Estimate is provided by parsing of the LogLines produces by RoboCopy.
Parse this object's stats into a enum.
Repackage the statistics into a new object
Used by ResultsBuilder as starting point for the results.
Should not be used anywhere else, as it kills the worker thread that calculates the Statistics objects.
Increment
Performs final processing of the previous file if needed
Increment
Method meant only to be called from AddFile method while SpecialHandling is true - helps normalize code and avoid repetition
Catch start copy progress of large files
Increment .Copied ( Triggered when copy progress = 100% )
Perform the calculation for the ByteStatistic
Creates a LongRunning task that is meant to periodically push out Updates to the UI on a thread isolated from the event thread.
Push the update to the public Stat Objects
Helper class to build a object.
Reference back to the RoboCommand that spawned this object
This is the last line that was logged.
Add a LogLine reported by RoboCopy to the LogLines list.
Builds the results from parsing the logLines.
This is used by the ProgressUpdateEventArgs to ignore the loglines when generating the estimate
RoboCopy Exit Codes
No Files Copied, No Errors Occured
One or more files were copied successfully
Some Extra files or directories were detected.
Examine the output log for details.
Some Mismatched files or directories were detected.
Examine the output log. Housekeeping might be required.
Some files or directories could not be copied
(copy errors occurred and the retry limit was exceeded).
Check these errors further.
Serious error. Robocopy did not copy any files.
Either a usage error or an error due to insufficient access privileges on the source or destination directories.
The Robocopy process exited prior to completion
Results provided by the RoboCopy command. Includes the Log, Exit Code, and statistics parsed from the log.
All Errors that were generated by RoboCopy during the run.
Information about number of Directories Copied, Skipped, Failed, etc.
If the job was cancelled, or run without a Job Summary, this will attempt to provide approximate results based on the Process.StandardOutput from Robocopy.
Results should only be treated as accurate if .ExitCodeValue >= 0 and the job was run with = FALSE
Information about number of Files Copied, Skipped, Failed, etc.
If the job was cancelled, or run without a Job Summary, this will attempt to provide approximate results based on the Process.StandardOutput from Robocopy.
Results should only be treated as accurate if .ExitCodeValue >= 0 and the job was run with = FALSE
Information about number of Bytes processed.
If the job was cancelled, or run without a Job Summary, this will attempt to provide approximate results based on the Process.StandardOutput from Robocopy.
Results should only be treated as accurate if .ExitCodeValue >= 0 and the job was run with = FALSE
Output Text reported by RoboCopy
Time the RoboCopy process was started
Time the RoboCopy process was completed / cancelled.
Length of Time the RoboCopy Process ran
Returns a string that represents the current object.
A string that represents the current object.
Object used to represent results from multiple s.
As are added to this object, it will update the Totals and Averages accordingly.
Implements:
where T = RoboCopyResults
Populate the new List object with this result as the first item.
Clone a RoboCopyResultsList into a new object
Delegate for objects to send notification that the list behind an interface has been updated
Sum of all DirectoryStatistics objects
Underlying value is Lazy{Statistic} object - Initial value not calculated until first request.
Sum of all ByteStatistics objects
Underlying value is Lazy{Statistic} object - Initial value not calculated until first request.
Sum of all FileStatistics objects
Underlying value is Lazy{Statistic} object - Initial value not calculated until first request.
Average of all SpeedStatistics objects
Underlying value is Lazy{SpeedStatistic} object - Initial value not calculated until first request.
Sum of all RoboCopyExitStatus objects
Underlying value is Lazy object - Initial value not calculated until first request.
The Collection of RoboCopy Results. Add/Removal of objects must be performed through this object's methods, not on the list directly.
Get or Set the element at the specified index.
The zero-based index of the item to Get or Set.
Get a snapshot of the ByteStatistics objects from this list.
New array of the ByteStatistic objects
Get a snapshot of the DirectoriesStatistic objects from this list.
New array of the DirectoriesStatistic objects
Get a snapshot of the FilesStatistic objects from this list.
New array of the FilesStatistic objects
Get a snapshot of the FilesStatistic objects from this list.
New array of the FilesStatistic objects
Get a snapshot of the FilesStatistic objects from this list.
New array of the FilesStatistic objects
Combine the into a single array of errors
New array of the ErrorEventArgs objects
Process the Added/Removed items, then fire the event
Clone this object to a new RoboCopyResultsList
Object that evaluates the ExitCode reported after RoboCopy finishes executing.
Initializes a new instance of the class.
ExitCode as reported by RoboCopy
ExitCode reported by RoboCopy converted into the Enum
Returns a string that represents the current object.
Represents the combination of multiple Exit Statuses
Initializes a new instance of the class.
Initializes a new instance of the class.
Clone this into a new instance
This event when the ExitStatus summary has changed
Overides
Atleast one objects combined into this result resulted in no errors and no files/directories copied.
Atleast one object combined into this result had been cancelled / exited prior to completion.
All jobs completed without errors or warnings.
All jobs completed without errors or warnings, but Extra Files/Folders were detected.
Combine the RoboCopyExitCodes of the supplied ExitStatus with this ExitStatus.
If any were Cancelled, set the WasCancelled property to TRUE. Otherwise combine the exit codes.
ExitStatus to combine with
Combine all the RoboCopyExitStatuses together.
Array or List of ExitStatuses to combine.
Combine all the RoboCopyExitStatuses together.
Array or List of ExitStatuses to combine.
new RoboCopyExitStatus object
Reset the value of the object
Reset the value of the object
Updates the Statistics every 250ms
Estimate of current number of directories processed while the job is still running.
Estimate is provided by parsing of the LogLines produces by RoboCopy.
Estimate of current number of files processed while the job is still running.
Estimate is provided by parsing of the LogLines produces by RoboCopy.
Estimate of current number of bytes processed while the job is still running.
Estimate is provided by parsing of the LogLines produces by RoboCopy.
Parse this object's stats into a enum.
Subscribe to the update events of a object
Unsubscribe from all bound Statistic objects
Unbind all the ProgressEstimators
Object returned by RoboQueue when a run has completed.
Add a result to the collection
Time the RoboQueue task was started
Time the RoboQueue task was completed / cancelled.
Should Only considered valid if = true.
Length of Time RoboQueue was running
Should Only considered valid if = true.
TRUE if the RoboQueue object that created this results set has not finished running yet.
TRUE if the RoboQueue object that created this results has completed running, or has been cancelled.
Gets the object at the specified index.
Contains information regarding average Transfer Speed.
Note: Runs that do not perform any copy operations or that exited prematurely ( ) will result in a null object.
Create new SpeedStatistic
Clone a SpeedStatistic
This toggle Enables/Disables firing the Event to avoid firing it when doing multiple consecutive changes to the values
This event will fire when the value of the SpeedStatistic is updated
Raise Property Change Event
Returns a string that represents the current object.
This object represents the Average of several objects, and contains
methods to facilitate that functionality.
Initialize a new object with the default values.
Initialize a new object.
Values will be set to the return values of and
Either a or a object.
If a is passed into this constructor, it wil be treated as the base instead.
Initialize a new object using .
Clone an AverageSpeedStatistic
Sum of all
Sum of all
Total number of SpeedStats that were combined to produce the Combined_* values
Set the values for this object to 0
Set the values for this object to 0
Add the results of the supplied SpeedStatistic objects to this object.
Does not automatically recalculate the average, and triggers no events.
If any supplied Speedstat object is actually an object, default functionality will combine the private fields
used to calculate the average speed instead of using the publicly reported speeds.
This ensures that combining the average of multiple objects returns the correct value.
Ex: One object with 2 runs and one with 3 runs will return the average of all 5 runs instead of the average of two averages.
SpeedStatistic Item to add
Setting this to TRUE will instead combine the calculated average of the , treating it as a single object.
Ignore the private fields, and instead use the calculated speeds)
Add the supplied SpeedStatistic collection to this object.
SpeedStatistic collection to add
Subtract the results of the supplied SpeedStatistic objects from this object.
Statistics Item to add
Subtract the supplied SpeedStatistic collection from this object.
SpeedStatistic collection to subtract
Immediately recalculate the BytesPerSec and MegaBytesPerMin values
Combine the supplied objects, then get the average.
Stats object
Combine the supplied objects, then get the average.
Collection of objects
New Statistics Object
Information about number of items Copied, Skipped, Failed, etc.
will not typically raise any events, but this object is used for other items, such as and to present results whose values may update periodically.
Create a new Statistic object of
Create a new Statistic object
Create a new Statistic object
Clone an existing Statistic object
Clone an existing Statistic object
Describe the Type of Statistics Object
Statistics object represents count of Directories
Statistics object represents count of Files
Statistics object represents a Size ( number of bytes )
This toggle Enables/Disables firing the Event to avoid firing it when doing multiple consecutive changes to the values
This event will fire when the value of the statistic is updated via Adding / Subtracting methods.
Provides object.
Allows use with both binding to controls and binding.
EventArgs can be passed into after casting.
Handles any value changes
Occurs when the Property is updated.
Occurs when the Property is updated.
Occurs when the Property is updated.
Occurs when the Property is updated.
Occurs when the Property is updated.
Occurs when the Property is updated.
Checks all values and determines if any of them are != 0.
Name of the Statistics Object
Returns a string that represents the current object.
Customize the returned string
Include string representation of
Include "Total:" / "Copied:" / etc in the string to identify the values
Value Delimieter
Include the delimiter after the 'Type' - Only used if us also true.
When is true, a space always exist after the type string. This would add delimiter instead of the space.
TRUE, TRUE, "," --> $"{Type} Total: {Total}, Copied: {Copied}, Skipped: {Skipped}, Mismatch: {Mismatch}, Failed: {Failed}, Extras: {Extras}"
FALSE, TRUE, "," --> $"Total: {Total}, Copied: {Copied}, Skipped: {Skipped}, Mismatch: {Mismatch}, Failed: {Failed}, Extras: {Extras}"
FALSE, FALSE, "," --> $"{Total}, {Copied}, {Skipped}, {Mismatch}, {Failed}, {Extras}"
Get the as a string
Get the string describing the
Get the string describing the
Get the string describing the
Get the string describing the
Get the string describing the
Get the string describing the
Parse a string and for the tokens reported by RoboCopy
Statistic Type to produce
LogLine produced by RoboCopy in Summary Section
New Statistic Object
Set the values for this object to 0
Reset all values to Zero ( 0 ) -- Used by for the properties
Prep Event Args for SETTERS of the properties
Prep event args for the ADD and RESET methods
Raises the events that were deferred while item was object was still being calculated by ADD / RESET
Add the supplied values to this Statistic object.
Events are defered until all the fields have been added together.
Add the results of the supplied Statistics object to this Statistics object.
Events are defered until all the fields have been added together.
Statistics Item to add
Add the results of the supplied Statistics objects to this Statistics object.
Statistics Item to add
Adds to the appropriate property based on the 'PropertyChanged' value.
Will only add the value if the == .
Arg provided by either or a Statistic's object's On*Changed events
Combine the results of the supplied statistics objects of the specified type.
Collection of objects
Create a new Statistic object of this type.
New Statistics Object
Combine the supplied objects, then get the average.
Array of Stats objects
New Statistics Object
Subtract Method used by
Events are deferred until all value changes have completed.
Statistics Item to subtract
Subtract the results of the supplied Statistics objects to this Statistics object.
Statistics Item to subtract
Statistics object to clone
Clone of the object with the subtracted from it.
RoboCopy switches for how to react if a copy/move operation errors
Create new RetryOptions with Default Settings
Clone a RetryOptions Object
RetryOptions object to clone
Specifies the number of retries N on failed copies (default is 0).
[/R:N]
Specifies the wait time N in seconds between retries (default is 30).
[/W:N]
Saves RetryCount and RetryWaitTime in the Registry as default settings.
[/REG]
Wait for sharenames to be defined.
[/TBD]
Combine this object with another RetryOptions object.
Any properties marked as true take priority. IEnumerable items are combined.
String Values will only be replaced if the primary object has a null/empty value for that property.
Wrapper for the RoboCopy process
The base object provided by the RoboSharp library.
Create a new RoboCommand object
Create a new RoboCommand object with the provided settings.
Each of the Options objects can be specified within this constructor. If left = null, a new object will be generated using the default options for that object.
Create a new RoboCommand with identical options at this RoboCommand
If Desired, the new RoboCommand object will share some of the same Property objects as the input .
For Example, that means that if a SelectionOption property changes, it will affect both RoboCommand objects since the property is shared between them.
If the Link* options are set to FALSE (default), then it will create new property objects whose settings match the current settings of .
Properties that can be linked:
( Linked by default )
( Linked by default )
RoboCommand to Clone
Specify a new source if desired. If left as null, will use Source from
Specify a new source if desired. If left as null, will use Destination from
Link the of the two commands ( True Default )
Link the of the two commands
Link the of the two commands ( True Default )
Link the of the two commands
Link the of the two commands
Create a new RoboCommand object
Stores the LastData processed by
ID Tag for the job - Allows consumers to find/sort/remove/etc commands within a list via string comparison
Value indicating if process is currently paused
Value indicating if process is currently running
Value indicating if process was Cancelled
TRUE if is set up (Copy Operation is scheduled to only operate within specified timeframe). Otherwise False.
Get the parameters string passed to RoboCopy based on the current setup
A new object is created every time the method is called, but will not be created until called for the first time.
Value indicating if the process should be killed when the method is called.
For example, if the RoboCopy process should exit when the program exits, this should be set to TRUE (default).
Handles
Occurs each time a new item has started processing
Handles
Occurs when an error occurs while generating the command that prevents the RoboCopy process from starting.
Handles
Occurs an error is detected by RoboCopy
Handles
Occurs when the RoboCopy process has finished executing and results are available.
Handles
Occurs each time the current item's progress is updated
Handles
Occurs when a is created during , allowing binding to occur within the event subscriber.
This event will occur once per Start.
Occurs if the RoboCommand task is stopped due to an unhandled exception. Occurs instead of
Pause execution of the RoboCopy process when == false
Resume execution of the RoboCopy process when == true
Immediately Kill the RoboCopy process
awaits then returns the results.
Returns the RoboCopy results once RoboCopy has finished executing.
awaits then returns the results.
Returns the List-Only results once RoboCopy has finished executing.
Run the currently selected options in ListOnly mode by setting = TRUE
Task that awaits , then resets the ListOnly option to original value.
Start the RoboCopy Process.
If overridden by a derived class, the override affects all Start* methods within RoboCommand. Base.Start() must be called to start the robocopy process.
Returns a task that reports when the RoboCopy process has finished executing.
Start the RoboCopy process and the watcher task
The continuation task that cleans up after the task that watches RoboCopy has finished executing.
Save this RoboCommand's options to a new RoboCopyJob ( *.RCJ ) file.
Note: This will not save the path submitted into .
Job Files don't care if the Source/Destination are invalid, since they just save the command values to a file.
Save into the RCJ file.
Save into the RCJ file.
Occurs when the Process reports an error prior to starting the robocopy process, not an 'error' from Robocopy
React to Process.StandardOutput
The RoboCopyResults object from the last run
Set the results to null - This is to prevent adding results from a previous run being added to the results list by RoboQueue
Generate the Parameters and Switches to execute RoboCopy with based on the configured settings
Combine this object's options with that of some JobFile
Dispose of this object. Kills RoboCopy process if == true && == false.
Finalizer -> Cleans up resources when garbage collected
IDisposable Implementation
Object that provides methods to generate new objects.
Create a new object using default settings.
This method is used by the other methods within the to generate the inital object that will be returned.
All settings are then applied to the object's options components (such as the source/destination parameters)
As such, overriding this one method will to provide will provide the other factory methods with the customized default IRobocommand object.
new object using the parameterless constructor
Create a new object with the specified and .
new object with the specified and .
Create a new object with the specified options
The options to apply to the generated object
The options to apply to the generated object
]
Contains a private List{IRoboCommand} object with controlled methods for access to it.
Attempting to modify the list while = true results in being thrown.
Implements the following:
-- Allow enumerating through the collection that is stored in a private list -- Also see
-- Allow subscription to collection changes against the list
-- Most properties will trigger events when updated.
-- Allow disposal of all objects in the list.
Initialize a new (empty) object.
Initialize a new (empty) object with a specificed Name.
Initialize a new object that contains the supplied .
Initialize a new object that contains the supplied collection.
IRoboCommand(s) to populate the list with.
Checks property of all items in the list.
INotifyPropertyChanged is not raised when this property changes.
Checks property of all items in the list.
INotifyPropertyChanged is not raised when this property changes.
Checks property of all items in the list.
INotifyPropertyChanged is not raised when this property changes.
Check the list and get the count of RoboCommands that are either in the 'Run' or 'Paused' state.
(Paused state is included since these can be resumed at any time)
Number of RoboCommands in the list
Name of this collection of RoboCommands
Wraps the private into a ReadOnlyCollection for public consumption and data binding.
This object will produce the sum of all the ProgressEstimator objects generated by the commands within the list.
After the first request, the values will be updated every 250ms while the Queue is still running.
Indicates if a task is currently running or paused.
When true, prevents starting new tasks and prevents modication of the list.
This is set true when is called while any of the items in the list were running, and set false when or is called.
Flag is set to TRUE if the 'Stop' command is issued. Reset to False when starting a new operation.
Indicates if the StartAll task is currently running.
Indicates if the StartAll_ListOnly task is currently running.
Indicates if the StartAll_ListOnly() operation has been completed.
Indicates if the StartAll() operation has been completed.
Specify the max number of RoboCommands to execute at the same time.
Set Value to 0 to allow infinite number of jobs (Will issue all start commands at same time)
Default Value = 1;
Report how many tasks has completed during the run.
This value is reset to 0 when a new run starts, and increments as each job exits.
Report how many tasks has completed successfully during the run.
This value is reset to 0 when a new run starts, and increments as each job exits.
Report how many tasks have been started during the run.
This value is reset to 0 when a new run starts, and increments as each job starts.
Contains the results from the most recent run started via
Any time StartALL_ListOnly is called, a new RoboQueueResults object will be created.
Contains the results from the most recent run started via
Any time StartALL is called, a new RoboQueueResults object will be created.
This bind to every IRoboCommand in the list.
This bind to every RoboCommand in the list.
This bind to every RoboCommand in the list.
This will occur for every RoboCommand in the list.
This bind to every RoboCommand in the list.
Occurs when the gets updated
Occurs when the gets updated
Handles
Occurs when a is created when starting a new task, allowing binding to occur within the event subscriber.
This event will occur once per Start. See notes on for more details.
Handles
Occurs each time a Command has started succesfully
Handles
Occurs after when the task started by the StartAll and StartAll_ListOnly methods has finished executing.
Occurs if the RoboQueue task is stopped due to an unhandled exception. Occurs instead of
Also occurs if any of the RoboCommand objects raise
Get the current instance of the object
New instance of the list.
Get the current of the object
New instance of the list.
Run against all items in the list.
Loop through the items in the list and issue on any commands where is true.
Loop through the items in the list and issue on any commands where is true.
Set all IRoboCommand objects to ListOnly mode, run them, then set all RoboCommands back to their previous ListOnly mode setting.
Create Task that Starts all RoboCommands.
, , and are applied to all IRoboCommand objects during this run.
New Task that finishes after all RoboCommands have stopped executing
Intercept OnCommandCompleted from each IRoboCommand, react, then raise this object's OnCommandCompleted event
Finalizer -> Ensures that all IRoboCommand objects get disposed of properly when program exits
Dispose all IRoboCommand objects contained in the list. - This will kill any Commands that have = true (default)
Gets the enumerator for the enumeating through this object's objects
Exception thrown when attempting to run a method accesses the list backing a RoboQueue object while the tasks are in progress.
This functionality is disabled if == true.
Performs then
Setup the ErrorToken and the path to RoboCopy.exe.
Create new LoggingOptions with Default Settings
Clone a RoboSharpConfiguration Object
RoboSharpConfiguration object to clone
Error Token Identifier -- EN = "ERROR", DE = "FEHLER", etc
Leave as / Set to null to use system default.
field backing property - Protected to allow DefaultConfig derived classes to set within constructor
Regex to identify Error Tokens with during LogLine parsing
Field backing property - Protected to allow DefaultConfig derived classes to set within constructor
Generate a new ErrorTokenRegex object from by insterting the into a standardized pattern.
Language Specific
Log Lines starting with this string indicate : New File -> Source FILE Exists, Destination does not
Log Lines starting with this string indicate : Destination File newer than Source
Log Lines starting with this string indicate : Source File newer than Destination
Log Lines starting with this string indicate : Source FILE is identical to Destination File
Log Lines starting with this string indicate : EXTRA FILE -> Destination Exists, but Source does not
Log Lines starting with this string indicate : MISMATCH FILE
Log Lines starting with this string indicate : File Failed to Copy
Log Lines starting with this string indicate : File was excluded by filters
Log Lines starting with this string indicate : File was excluded by or filters
Log Lines starting with this string indicate : File was excluded by filters
Log Lines starting with this string indicate : File was excluded by filters
Log Lines starting with this string indicate : File was excluded by or filters
Log Lines starting with this string indicate : File was excluded by or filters
Log Lines starting with this string indicate : File was excluded by filters
Log Lines starting with this string indicate : File was included by filters
Log Lines starting with this string indicate : New Dir -> Directory will be copied to Destination
Log Lines starting with this string indicate : Extra Dir -> Does not exist in source
Existing Dirs do not have an identifier on the line. Instead, this string will be used when creating the object to indicate an Existing Directory.
Log Lines starting with this string indicate : Folder was excluded by filters
Specify the path to RoboCopy.exe here. If not set, use the default copy.
Default is retrieved from the OEMCodePage
Default is retrieved from the OEMCodePage
RoboCopy Switches that determine which folders and files are selected for copying/moving
Create new SelectionOptions with Default Settings
Create new SelectionOptions using the provided
Clone a SelectionOptions Object
Clone this SelectionOptions Object
This regex is used when the { } and { } properties are set in order to split the input string to a List{string}
Regex Tester to use with to get all the matches from a string.
Use { } to split the , then add the matches to the suppplied .
String to perform against
List to add regex matches to
Copies only files for which the Archive attribute is set.
[/A]
Copies only files for which the Archive attribute is set, and resets the Archive attribute.
[/M]
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]
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]
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 ...]
This property is now backed by the ExcludedFiles List{String} property.
Get -> Ensures all strings in { } are wrapped in quotes if needed, and concats the items into a single string.
Set -- Clears ExcludedFiles and splits this list using a regex to populate the list.
Allows you to supply a set of files to copy or use wildcard characters (* or ?).
JobOptions file saves these into the /IF (Include Files) section
Directories should be separated by spaces.
Excludes directories that match the specified names or paths.
[/XD Directory Directory ...]
This property is now backed by the ExcludedDirectories List{String} property.
Get -> Ensures all strings in { } are wrapped in quotes if needed, and concats the items into a single string.
Set -> Clears ExcludedDirs and splits this list using a regex to populate the list.
Allows you to supply a set of files to copy or use wildcard characters (* or ?).
JobOptions file saves these into the /IF (Include Files) section
Excludes changed files.
[/XC]
Excludes newer files.
[/XN]
Excludes older files.
[/XO]
Excludes extra files and directories.
[/XX]
Excludes lonely files and directories.
[/XL]
Includes the same files.
[/IS]
Includes tweaked files.
[/IT]
Zero indicates that this feature is turned off.
Specifies the maximum file size (to exclude files bigger than N bytes).
[/MAX:N]
Zero indicates that this feature is turned off.
Specifies the minimum file size (to exclude files smaller than N bytes).
[/MIN:N]
Specifies the maximum file age (to exclude files older than N days or date).
[/MAXAGE:N OR YYYYMMDD]
Specifies the minimum file age (exclude files newer than N days or date).
[/MINAGE:N OR YYYYMMDD]
Specifies the maximum last access date (excludes files unused since Date).
[/MAXLAD:YYYYMMDD]
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.
[/MINLAD:N or YYYYMMDD]
Excludes junction points, which are normally included by default.
[/XJ]
Assumes FAT file times (two-second precision).
[/FFT]
Compensates for one-hour DST time differences.
[/DST]
Excludes junction points for directories.
[/XJD]
Excludes junction points for files.
[/XJF]
Converts a enum to its RASHCNETO string.
Accepts: ReadOnly, Archive, System, Hidden, Compressed, NotContentIndexed, Encrypted, Temporary, Offline
Ignores: All Other Attributes
Pass in NULL value to return empty string.
RASHCNETO depending on submitted enum
Combine this object with another RetryOptions object.
Any properties marked as true take priority. IEnumerable items are combined.
String\Long Values will only be replaced if the primary object has a null/empty value for that property.
Enum to define various selection options that can be toggled for the RoboCopy process.
Set RoboCopy options to their defaults
Apply the to this command
Options to apply
Translate the selection bools of this object to its representation
The representation of this object.
taken from https://stackoverflow.com/a/49641055
Contains methods for CancelleableSleep and WaitUntil
Wait synchronously until this task has reached the specified
Wait asynchronously until this task has reached the specified
Checks every 100ms
Wait synchronously until this task has reached the specified
Checks every milliseconds
TimeSpan to sleep the thread
Use await Task.Delay to sleep the thread.
True if timer has expired (full duration slep), otherwise false.
Number of milliseconds to wait"/>
Use await Task.Delay to sleep the thread.
Supplied tokens are used to create a LinkedToken that can cancel the sleep at any point.
True if slept full duration, otherwise false.
Number of milliseconds to wait"/>
Use to create the token used to cancel the delay
Extends the Generic class with an event that will fire when the list is updated via standard list methods
Type of object the list will contain
This class is being provided by the RoboSharp DLL
This event fires whenever the List's array is updated.
Raise the event.
Override this method to provide post-processing of Added/Removed items within derived classes.
Replace an item in the list.
Search for this item in the list. If found, replace it. If not found, return false. will not be added to the list.
This item will replace the . If was not found, this item does not get added to the list.
True if the was found in the list and successfully replaced. Otherwise false.
Replace an item in the list
Index of the item to replace
This item will replace the item at the specified
True if the the item was successfully replaced. Otherwise throws.
Replaces the items in this list with the items in supplied collection. If the collection has more items than will be removed from the list, the remaining items will be added to the list.
EX: List has 10 items, collection has 5 items, index of 8 is specified (which is item 9 on 0-based index) -> Item 9 + 10 are replaced, and remaining 3 items from collection are added to the list.
Index of the item to replace
Collection of items to insert into the list.
True if the the collection was successfully inserted into the list. Otherwise throws.
Get or Set the element at the specified index.
The zero-based index of the item to Get or Set.
Generates event for item that was added and item that was shifted ( Event is raised twice )
Generates event for items that were added and items that were shifted ( Event is raised twice )
Per rules, generates event for every item that has moved within the list.
Set parameter in overload to generate a single event instead.
Action to perform that will rearrange items in the list - should not add, remove or replace!
List of items that are intended to rearrage - can be whole or subset of list
If TRUE: Create a 'Move' OnCollectionChange event for all items that were moved within the list.
If FALSE: Generate a single event with