From 28a46e3371c21cf77b514374253308c6cca7453c Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch> Date: Fri, 2 Mar 2018 23:43:00 +0100 Subject: [PATCH] Make COPY and DCOPY flags for RoboCopy configurable. Note that they are not included in the example configuration files as these settings can easily mess up everything and should only be adjusted with great care. The default settings are valid on Windows 7 and Server 2012 and were successfully tested on those versions. Fixes #11 --- ATxCommon/Serializables/ServiceConfig.cs | 12 ++++++++++++ ATxService/RoboCommand.cs | 10 +++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ATxCommon/Serializables/ServiceConfig.cs b/ATxCommon/Serializables/ServiceConfig.cs index ea06d38..2fd864a 100644 --- a/ATxCommon/Serializables/ServiceConfig.cs +++ b/ATxCommon/Serializables/ServiceConfig.cs @@ -117,6 +117,18 @@ namespace ATxCommon.Serializables /// See the RoboCopy documentation for more details. public int InterPacketGap { get; set; } = 0; + /// <summary> + /// Setting for the RoboCopy /COPY parameter, valid flags are D=Data, A=Attributes, + /// T=Timestamps, S=Security(ACLs), O=Owner info, U=aUditing info. Default: "DT". + /// </summary> + public string CopyFlags { get; set; } = "DT"; + + /// <summary> + /// Setting for the RoboCopy /DCOPY parameter, valid flags depend on the version of + /// RoboCopy used and should only be changed with greatest care! Default: "T". + /// </summary> + public string DirectoryCopyFlags { get; set; } = "T"; + /// <summary> /// A list of process names causing transfers to be suspended if running. /// </summary> diff --git a/ATxService/RoboCommand.cs b/ATxService/RoboCommand.cs index 36dd9d6..113e100 100644 --- a/ATxService/RoboCommand.cs +++ b/ATxService/RoboCommand.cs @@ -68,14 +68,10 @@ namespace ATxService // copyflags : // D=Data, A=Attributes, T=Timestamps // S=Security=NTFS ACLs, O=Owner info, U=aUditing info + _roboCommand.CopyOptions.CopyFlags = _config.CopyFlags; - // /SEC :: copy files with security (equivalent to /COPY:DATS) - // _roboCommand.CopyOptions.CopyFilesWithSecurity = true; - // /COPYALL :: copy all file info (equivalent to /COPY:DATSOU) - // _roboCommand.CopyOptions.CopyAll = true; - _roboCommand.CopyOptions.CopyFlags = "DT"; - - _roboCommand.CopyOptions.DirectoryCopyFlags = "T"; + // /DCOPY :: directory copy settings (T=Timestamps) + _roboCommand.CopyOptions.DirectoryCopyFlags = _config.DirectoryCopyFlags; // select options _roboCommand.SelectionOptions.ExcludeOlder = true; -- GitLab