diff --git a/src/ModularPipelines/FileSystem/Folder.cs b/src/ModularPipelines/FileSystem/Folder.cs index 4e3f290fb8..d29da5dc77 100644 --- a/src/ModularPipelines/FileSystem/Folder.cs +++ b/src/ModularPipelines/FileSystem/Folder.cs @@ -95,9 +95,13 @@ public void Delete() /// /// Removes all files and subdirectories within the folder. /// + /// + /// This method preserves backward compatibility by not removing read-only attributes. + /// Use with removeReadOnlyAttribute: true to handle read-only files. + /// public void Clean() { - Clean(removeReadOnlyAttribute: true); + Clean(removeReadOnlyAttribute: false); } /// @@ -153,6 +157,8 @@ public Folder CopyTo(string targetPath) /// A new instance representing the copied folder. public Folder CopyTo(string targetPath, bool preserveTimestamps) { + LogFolderOperationWithDestination("Copying Folder: {Source} > {Destination} [Module: {ModuleName}, Activity: {ActivityId}]", this, targetPath); + Directory.CreateDirectory(targetPath); // Copy all subdirectories first @@ -206,8 +212,6 @@ public Folder CopyTo(string targetPath, bool preserveTimestamps) targetRootDir.LastAccessTimeUtc = DirectoryInfo.LastAccessTimeUtc; } - LogFolderOperationWithDestination("Copied Folder: {Source} > {Destination} [Module: {ModuleName}, Activity: {ActivityId}]", this, targetPath); - return new Folder(targetPath); }