Continue and OverRide option in FileMaintenance.ps1 - 7k2mpa/FileMaintenace GitHub Wiki
Summary
You can control copy and move action with -OverRide and -Continue option when files exist in the destination.
Option(s) | Newer or Equal File | Older File |
---|---|---|
Nothing | Error/No & Terminate | Error/No & Terminate |
Continue | Warning/No | Warning/No |
ContinueAsNormal | Normal/No | Normal/No |
OverRide | Warning/No | Warning/Yes |
OverRideAsNormal | Warning/No | Normal/Yes |
OverRideForce | Warning/Yes | Warning/Yes |
OverRideForce&OverRideAsNormal | Normal/Yes | Normal/Yes |
Legend [Return Code] / [OverRide a file in the destination]
Detail
Specify no option.
If a file exist in the destination, the script output an Error and terminate and return Error exit code.
OverRide
If a file in the destination is equal or newer than last write time of the source file, the script dose not override and output a Warning and return Warning exit code.
If a file in the destination is not equal or newer than last write time of the source file, the script override a file in the destination and output a Warning and return Warning exit code.
Continue
The script dose not override files in the destination and skip processing the source file and process next files and output a Warning and return Warning exit code.
AsNormal
If files exist in the destination, with -Continue or -OverRide option the script output a Warning and return Warning exit code.
With AsNormal, the script return Normal exit code.
If you want to specify 'AsNormal' , specify -ContinueAsNormal or -OverRideAsNormal option.
OverRideForce
Even if a file in the destination is equal or newer than last write time of the source file, the script override files in the destination and output a Warning and return Warning exit code.
If a file in the destination is not equal or newer than last write time of the source file, the script override files in the destination and output a Warning and return Warning exit code.
Reminds
-OverRide(AsNormal,Force) is prior to -Continue(AsNormal)
But -OverRide(AsNormal,Force)'s priority is only for local action.
Without -Continue option, if the script fails to process in another section or another reason (e.g. an execution user of the script dose not have a write permission of the destination file) , the script terminates.
With -Continue option, if the script fails, dose not terminate and process continuously.