Copies the content of a directory to a new location preserving the original file modification times and relative Unix symlinks.
More...
|
| CopyDirectory ([Localizable(false)] string sourcePath, [Localizable(false)] string destinationPath, bool preserveDirectoryTimestamps=true, bool overwrite=false) |
| Creates a new directory copy task. More...
|
|
void | Run (CancellationToken cancellationToken=default, ICredentialProvider? credentialProvider=null, IProgress< TaskSnapshot >? progress=null) |
| Runs the task and blocks until it is complete.
|
|
|
override void | Execute () |
| The actual code to be executed.
|
|
virtual void | CopyFile (FileInfo sourceFile, FileInfo destinationFile) |
| Copies a single file from one location to another. Can be overridden to modify the copying behavior. More...
|
|
virtual void | CreateSymlink ([Localizable(false)] string linkPath, [Localizable(false)] string linkTarget) |
| Creates a Unix symbolic link. Can be overridden to modify the symlinking behavior. More...
|
|
Copies the content of a directory to a new location preserving the original file modification times and relative Unix symlinks.
◆ CopyDirectory()
NanoByte.Common.Storage.CopyDirectory.CopyDirectory |
( |
[Localizable(false)] string |
sourcePath, |
|
|
[Localizable(false)] string |
destinationPath, |
|
|
bool |
preserveDirectoryTimestamps = true , |
|
|
bool |
overwrite = false |
|
) |
| |
|
inline |
Creates a new directory copy task.
- Parameters
-
sourcePath | The path of source directory. Must exist! |
destinationPath | The path of the target directory. May exist. Must be empty if overwrite is false . |
preserveDirectoryTimestamps | true to preserve the modification times for directories as well; false to preserve only the file modification times. |
overwrite | Overwrite existing files and directories at the destinationPath . This will even replace read-only files! |
◆ CopyFile()
virtual void NanoByte.Common.Storage.CopyDirectory.CopyFile |
( |
FileInfo |
sourceFile, |
|
|
FileInfo |
destinationFile |
|
) |
| |
|
inlineprotectedvirtual |
Copies a single file from one location to another. Can be overridden to modify the copying behavior.
- Exceptions
-
IOException | A problem occurred while copying the file. |
UnauthorizedAccessException | Read access to the sourceFile or write access to the destinationFile is not permitted. |
Reimplemented in NanoByte.Common.Storage.MoveDirectory.
◆ CreateSymlink()
virtual void NanoByte.Common.Storage.CopyDirectory.CreateSymlink |
( |
[Localizable(false)] string |
linkPath, |
|
|
[Localizable(false)] string |
linkTarget |
|
) |
| |
|
inlineprotectedvirtual |
Creates a Unix symbolic link. Can be overridden to modify the symlinking behavior.
- Parameters
-
linkPath | The path of the link to create. |
linkTarget | The path of the existing file or directory to point to (relative to linkPath ). |
- Exceptions
-
InvalidOperationException | The underlying Unix subsystem failed to process the request (e.g. because of insufficient rights). |
IOException | The underlying Unix subsystem failed to process the request (e.g. because of insufficient rights). |
◆ DestinationPath
string NanoByte.Common.Storage.CopyDirectory.DestinationPath |
|
get |
The path of the target directory. May exist. Must be empty if Overwrite is false
.
◆ Overwrite
bool NanoByte.Common.Storage.CopyDirectory.Overwrite |
|
get |
Overwrite existing files and directories at the DestinationPath. This will even replace read-only files!
◆ PreserveDirectoryTimestamps
bool NanoByte.Common.Storage.CopyDirectory.PreserveDirectoryTimestamps |
|
get |
true
to preserve the modification times for directories as well; false
to preserve only the file modification times.
◆ SourcePath
string NanoByte.Common.Storage.CopyDirectory.SourcePath |
|
get |
The path of source directory. Must exist!
The documentation for this class was generated from the following file:
- Common/Storage/CopyDirectory.cs