Skip to content
Auto
Products

FileSystemExtensions

Namespace: TagBites.IO
Assembly: TagBites.IO.dll
Product: TagBites.IO v. 2.0.0

Provides extension methods for the file system classes.

public static class FileSystemExtensions

Inheritance: object → FileSystemExtensions

Section titled “Copy(IFileResourceLink, FileLink, bool, FileSystemExceptionResolveDelegate)”

Copies an existing file/file version to a new file. Overwriting a file of the same name is allowed.

public static void Copy(this IFileResourceLink source, this FileLink destination, this bool overwrite, this FileSystemExceptionResolveDelegate exceptionResolver)
Section titled “Copy(IFileResourceLink, FileLink, FileSystemConflictResolveMode, FileSystemExceptionResolveDelegate)”

Copies an existing file/file version to a new file.

public static void Copy(this IFileResourceLink source, this FileLink destination, this FileSystemConflictResolveMode conflictResolveMode, this FileSystemExceptionResolveDelegate exceptionResolver)
Section titled “Copy(IFileResourceLink, FileLink, FileSystemConflictResolveDelegate, FileSystemExceptionResolveDelegate)”

Copies an existing file/file version to a new file.

public static void Copy(this IFileResourceLink source, this FileLink destination, this FileSystemConflictResolveDelegate conflictResolver, this FileSystemExceptionResolveDelegate exceptionResolver)
Section titled “Copy(DirectoryLink, DirectoryLink, bool, FileSystemExceptionResolveDelegate)”

Copies an existing directory to a new directory. Overwriting a file of the same name is allowed.

public static void Copy(this DirectoryLink source, this DirectoryLink destination, this bool overwrite, this FileSystemExceptionResolveDelegate exceptionResolver)
Section titled “Copy(DirectoryLink, DirectoryLink, FileSystemConflictResolveMode, FileSystemExceptionResolveDelegate)”

Copies an existing directory to a new directory.

public static void Copy(this DirectoryLink source, this DirectoryLink destination, this FileSystemConflictResolveMode conflictResolveMode, this FileSystemExceptionResolveDelegate exceptionResolver)
Section titled “Copy(DirectoryLink, DirectoryLink, FileSystemConflictResolveDelegate, FileSystemExceptionResolveDelegate)”

Copies an existing directory to a new directory.

public static void Copy(this DirectoryLink source, this DirectoryLink destination, this FileSystemConflictResolveDelegate conflictResolver, this FileSystemExceptionResolveDelegate exceptionResolver)
Section titled “CopyAsync(IFileResourceLink, FileLink, bool, FileSystemExceptionResolveDelegate)”

Asynchronously copies an existing file/file version to a new file. Overwriting a file of the same name is allowed.

public static Task CopyAsync(this IFileResourceLink source, this FileLink destination, this bool overwrite, this FileSystemExceptionResolveDelegate exceptionResolver)

Task

The task object representing the asynchronous operation.

Section titled “CopyAsync(IFileResourceLink, FileLink, FileSystemConflictResolveMode, FileSystemExceptionResolveDelegate)”

Asynchronously copies an existing file/file version to a new file.

public static Task CopyAsync(this IFileResourceLink source, this FileLink destination, this FileSystemConflictResolveMode conflictResolveMode, this FileSystemExceptionResolveDelegate exceptionResolver)

Task

The task object representing the asynchronous operation.

Section titled “CopyAsync(IFileResourceLink, FileLink, FileSystemConflictResolveDelegate, FileSystemExceptionResolveDelegate)”

Asynchronously copies an existing file/file version to a new file.

public static Task CopyAsync(this IFileResourceLink source, this FileLink destination, this FileSystemConflictResolveDelegate conflictResolver, this FileSystemExceptionResolveDelegate exceptionResolver)

Task

The task object representing the asynchronous operation.

Section titled “CopyAsync(DirectoryLink, DirectoryLink, bool, FileSystemExceptionResolveDelegate)”

Asynchronously copies an existing directory to a new directory. Overwriting a file of the same name is allowed.

public static Task CopyAsync(this DirectoryLink source, this DirectoryLink destination, this bool overwrite, this FileSystemExceptionResolveDelegate exceptionResolver)

Task

The task object representing the asynchronous operation.

Section titled “CopyAsync(DirectoryLink, DirectoryLink, FileSystemConflictResolveMode, FileSystemExceptionResolveDelegate)”

Asynchronously copies an existing directory to a new directory.

public static Task CopyAsync(this DirectoryLink source, this DirectoryLink destination, this FileSystemConflictResolveMode conflictResolveMode, this FileSystemExceptionResolveDelegate exceptionResolver)

Task

Section titled “CopyAsync(DirectoryLink, DirectoryLink, FileSystemConflictResolveDelegate, FileSystemExceptionResolveDelegate)”

Asynchronously copies an existing directory to a new directory.

public static Task CopyAsync(this DirectoryLink source, this DirectoryLink destination, this FileSystemConflictResolveDelegate conflictResolver, this FileSystemExceptionResolveDelegate exceptionResolver)

Task

The task object representing the asynchronous operation.

Section titled “CopyTo(IFileSystemLink, DirectoryLink, bool, FileSystemExceptionResolveDelegate)”

Copies an existing file/directory/file version to a new directory. Overwriting a file of the same name is allowed.

public static FileSystemStructureLink CopyTo(this IFileSystemLink source, this DirectoryLink destination, this bool overwrite, this FileSystemExceptionResolveDelegate exceptionResolver)
  • source IFileSystemLink
    The link to the file/directory/file version to copy.
  • destination DirectoryLink
    The link to the destination directory.
  • overwrite bool
    true if the file/directory/file version in the destination directory can be overwritten; otherwise, false.
  • exceptionResolver FileSystemExceptionResolveDelegate
    The delegate to resolve exceptions.

FileSystemStructureLink

A FileSystemStructureLink object representing the link to the moved file/directory.

Section titled “CopyTo(IFileSystemLink, DirectoryLink, FileSystemConflictResolveMode, FileSystemExceptionResolveDelegate)”

Copies an existing file/directory/file version to a new directory.

public static FileSystemStructureLink CopyTo(this IFileSystemLink source, this DirectoryLink destination, this FileSystemConflictResolveMode conflictResolveMode, this FileSystemExceptionResolveDelegate exceptionResolver)

FileSystemStructureLink

A FileSystemStructureLink object representing the link to the moved file/directory.

Section titled “CopyTo(IFileSystemLink, DirectoryLink, FileSystemConflictResolveDelegate, FileSystemExceptionResolveDelegate)”

Copies an existing file/directory/file version to a new directory.

public static FileSystemStructureLink CopyTo(this IFileSystemLink source, this DirectoryLink destination, this FileSystemConflictResolveDelegate conflictResolver, this FileSystemExceptionResolveDelegate exceptionResolver)

FileSystemStructureLink

A FileSystemStructureLink object representing the link to the moved file/directory.

Section titled “CopyToAsync(IFileSystemLink, DirectoryLink, bool, FileSystemExceptionResolveDelegate)”

Asynchronously copies an existing file/directory/file version to a new directory. Overwriting a file of the same name is allowed.

public static Task<FileSystemStructureLink> CopyToAsync(this IFileSystemLink source, this DirectoryLink destination, this bool overwrite, this FileSystemExceptionResolveDelegate exceptionResolver)
  • source IFileSystemLink
    The link to the file/directory/file version to copy.
  • destination DirectoryLink
    The link to the destination directory.
  • overwrite bool
    true if the file/directory/file version in the destination directory can be overwritten; otherwise, false.
  • exceptionResolver FileSystemExceptionResolveDelegate
    The delegate to resolve exceptions.

Task<FileSystemStructureLink>

The task object representing the asynchronous operation. The value of the parameter contains a link to the moved file/directory.

Section titled “CopyToAsync(IFileSystemLink, DirectoryLink, FileSystemConflictResolveMode, FileSystemExceptionResolveDelegate)”

Asynchronously copies an existing file/directory/file version to a new directory.

public static Task<FileSystemStructureLink> CopyToAsync(this IFileSystemLink source, this DirectoryLink destination, this FileSystemConflictResolveMode conflictResolveMode, this FileSystemExceptionResolveDelegate exceptionResolver)

Task<FileSystemStructureLink>

The task object representing the asynchronous operation. The value of the parameter contains a link to the moved file/directory.

Section titled “CopyToAsync(IFileSystemLink, DirectoryLink, FileSystemConflictResolveDelegate, FileSystemExceptionResolveDelegate)”

Asynchronously copies an existing file/directory/file version to a new directory.

public static Task<FileSystemStructureLink> CopyToAsync(this IFileSystemLink source, this DirectoryLink destination, this FileSystemConflictResolveDelegate conflictResolver, this FileSystemExceptionResolveDelegate exceptionResolver)

Task<FileSystemStructureLink>

The task object representing the asynchronous operation. The value of the parameter contains a link to the moved file/directory.

Section titled “Move(FileLink, FileLink, bool, FileSystemExceptionResolveDelegate)”

Moves a specified file to a new location, providing the option to specify a new file name. Overwriting a file of the same name is allowed.

public static void Move(this FileLink source, this FileLink destination, this bool overwrite, this FileSystemExceptionResolveDelegate exceptionResolver)
  • source FileLink
    The link to the file to move.
  • destination FileLink
    The link to the destination file.
  • overwrite bool
    true if the destination file can be overwritten; otherwise, false.
  • exceptionResolver FileSystemExceptionResolveDelegate
    The delegate to resolve exceptions.
Section titled “Move(FileLink, FileLink, FileSystemConflictResolveMode, FileSystemExceptionResolveDelegate)”

Moves a specified file to a new location, providing the option to specify a new file name.

public static void Move(this FileLink source, this FileLink destination, this FileSystemConflictResolveMode conflictResolveMode, this FileSystemExceptionResolveDelegate exceptionResolver)
Section titled “Move(FileLink, FileLink, FileSystemConflictResolveDelegate, FileSystemExceptionResolveDelegate)”

Moves a specified file to a new location, providing the option to specify a new file name

public static void Move(this FileLink source, this FileLink destination, this FileSystemConflictResolveDelegate conflictResolver, this FileSystemExceptionResolveDelegate exceptionResolver)
Section titled “Move(DirectoryLink, DirectoryLink, bool, FileSystemExceptionResolveDelegate)”

Moves a specified directory to a new location, providing the option to specify a new directory name. Overwriting a directory of the same name is allowed.

public static void Move(this DirectoryLink source, this DirectoryLink destination, this bool overwrite, this FileSystemExceptionResolveDelegate exceptionResolver)
Section titled “Move(DirectoryLink, DirectoryLink, FileSystemConflictResolveMode, FileSystemExceptionResolveDelegate)”

Moves a specified directory to a new location, providing the option to specify a new directory name.

public static void Move(this DirectoryLink source, this DirectoryLink destination, this FileSystemConflictResolveMode conflictResolveMode, this FileSystemExceptionResolveDelegate exceptionResolver)
Section titled “Move(DirectoryLink, DirectoryLink, FileSystemConflictResolveDelegate, FileSystemExceptionResolveDelegate)”

Moves a specified directory to a new location, providing the option to specify a new directory name.

public static void Move(this DirectoryLink source, this DirectoryLink destination, this FileSystemConflictResolveDelegate conflictResolver, this FileSystemExceptionResolveDelegate exceptionResolver)
Section titled “MoveAsync(FileLink, FileLink, bool, FileSystemExceptionResolveDelegate)”

Asynchronously moves a specified file to a new location, providing the option to specify a new file name. Overwriting a file of the same name is allowed.

public static Task MoveAsync(this FileLink source, this FileLink destination, this bool overwrite, this FileSystemExceptionResolveDelegate exceptionResolver)
  • source FileLink
    The link to the file to move.
  • destination FileLink
    The link to the destination file.
  • overwrite bool
    true if the destination file can be overwritten; otherwise, false.
  • exceptionResolver FileSystemExceptionResolveDelegate
    The delegate to resolve exceptions.

Task

The task object representing the asynchronous operation.

Section titled “MoveAsync(FileLink, FileLink, FileSystemConflictResolveMode, FileSystemExceptionResolveDelegate)”

Asynchronously moves a specified file to a new location, providing the option to specify a new file name.

public static Task MoveAsync(this FileLink source, this FileLink destination, this FileSystemConflictResolveMode conflictResolveMode, this FileSystemExceptionResolveDelegate exceptionResolver)

Task

The task object representing the asynchronous operation.

Section titled “MoveAsync(FileLink, FileLink, FileSystemConflictResolveDelegate, FileSystemExceptionResolveDelegate)”

Asynchronously moves a specified file to a new location, providing the option to specify a new file name.

public static Task MoveAsync(this FileLink source, this FileLink destination, this FileSystemConflictResolveDelegate conflictResolver, this FileSystemExceptionResolveDelegate exceptionResolver)

Task

The task object representing the asynchronous operation.

Section titled “MoveAsync(DirectoryLink, DirectoryLink, bool, FileSystemExceptionResolveDelegate)”

Asynchronously moves a specified directory to a new location, providing the option to specify a new directory name. Overwriting a directory of the same name is allowed.

public static Task MoveAsync(this DirectoryLink source, this DirectoryLink destination, this bool overwrite, this FileSystemExceptionResolveDelegate exceptionResolver)

Task

The task object representing the asynchronous operation.

Section titled “MoveAsync(DirectoryLink, DirectoryLink, FileSystemConflictResolveMode, FileSystemExceptionResolveDelegate)”

Asynchronously moves a specified directory to a new location, providing the option to specify a new directory name.

public static Task MoveAsync(this DirectoryLink source, this DirectoryLink destination, this FileSystemConflictResolveMode conflictResolveMode, this FileSystemExceptionResolveDelegate exceptionResolver)

Task

The task object representing the asynchronous operation.

Section titled “MoveAsync(DirectoryLink, DirectoryLink, FileSystemConflictResolveDelegate, FileSystemExceptionResolveDelegate)”

Asynchronously moves a specified directory to a new location, providing the option to specify a new directory name.

public static Task MoveAsync(this DirectoryLink source, this DirectoryLink destination, this FileSystemConflictResolveDelegate conflictResolver, this FileSystemExceptionResolveDelegate exceptionResolver)

Task

The task object representing the asynchronous operation.

Section titled “MoveTo(FileSystemStructureLink, DirectoryLink, bool, FileSystemExceptionResolveDelegate)”

Moves a specified file/directory to a new location, providing the option to specify a new file name. Overwriting a file of the same name is allowed.

public static FileSystemStructureLink MoveTo(this FileSystemStructureLink source, this DirectoryLink destination, this bool overwrite, this FileSystemExceptionResolveDelegate exceptionResolver)

FileSystemStructureLink

A FileSystemStructureLink object representing the link to the moved file/directory.

Section titled “MoveTo(FileSystemStructureLink, DirectoryLink, FileSystemConflictResolveMode, FileSystemExceptionResolveDelegate)”

Moves a specified file/directory to a new directory, providing the option to specify a new file name.

public static FileSystemStructureLink MoveTo(this FileSystemStructureLink source, this DirectoryLink destination, this FileSystemConflictResolveMode conflictResolveMode, this FileSystemExceptionResolveDelegate exceptionResolver)

FileSystemStructureLink

A FileSystemStructureLink object representing the link to the moved file/directory.

Section titled “MoveTo(FileSystemStructureLink, DirectoryLink, FileSystemConflictResolveDelegate, FileSystemExceptionResolveDelegate)”

Moves a specified file/directory to a new directory, providing the option to specify a new file name.

public static FileSystemStructureLink MoveTo(this FileSystemStructureLink source, this DirectoryLink destination, this FileSystemConflictResolveDelegate conflictResolver, this FileSystemExceptionResolveDelegate exceptionResolver)

FileSystemStructureLink

A FileSystemStructureLink object representing the link to the moved file/directory.

Section titled “MoveToAsync(FileSystemStructureLink, DirectoryLink, bool, FileSystemExceptionResolveDelegate)”

Asynchronously moves a specified file/directory to a new directory, providing the option to specify a new file name. Overwriting a file of the same name is allowed.

public static Task<FileSystemStructureLink> MoveToAsync(this FileSystemStructureLink source, this DirectoryLink destination, this bool overwrite, this FileSystemExceptionResolveDelegate exceptionResolver)

Task<FileSystemStructureLink>

The task object representing the asynchronous operation. The value of the parameter contains a link to the moved file/directory.

Section titled “MoveToAsync(FileSystemStructureLink, DirectoryLink, FileSystemConflictResolveMode, FileSystemExceptionResolveDelegate)”

Asynchronously moves a specified file/directory to a new directory, providing the option to specify a new file name.

public static Task<FileSystemStructureLink> MoveToAsync(this FileSystemStructureLink source, this DirectoryLink destination, this FileSystemConflictResolveMode conflictResolveMode, this FileSystemExceptionResolveDelegate exceptionResolver)

Task<FileSystemStructureLink>

The task object representing the asynchronous operation. The value of the parameter contains a link to the moved file/directory.

Section titled “MoveToAsync(FileSystemStructureLink, DirectoryLink, FileSystemConflictResolveDelegate, FileSystemExceptionResolveDelegate)”

Asynchronously moves a specified file/directory to a new directory, providing the option to specify a new file name.

public static Task<FileSystemStructureLink> MoveToAsync(this FileSystemStructureLink source, this DirectoryLink destination, this FileSystemConflictResolveDelegate conflictResolver, this FileSystemExceptionResolveDelegate exceptionResolver)

Task<FileSystemStructureLink>

The task object representing the asynchronous operation. The value of the parameter contains a link to the moved file/directory.

Opens a file, reads all bytes in the file into a byte[], and then closes the file.

public static byte[] ReadAllBytes(this IFileResourceLink source)

byte[]

A String containing all bytes in the file.

Asynchronously opens a file, reads all bytes in the file into a byte[], and then closes the file.

public static Task<byte[]> ReadAllBytesAsync(this IFileResourceLink source)

Task<byte[]>

The task object representing the asynchronous operation. The value of the parameter contains array of Byte containing all bytes in the file.

Opens a text file, reads all the text in the file into a string, and then closes the file.

public static string ReadAllText(this IFileResourceLink source)

string

A String containing all text in the file.

Opens a file, reads all text in the file into a string with the specified encoding, and then closes the file.

public static string ReadAllText(this IFileResourceLink source, this Encoding encoding)
  • source IFileResourceLink
    The link to the file/file version.
  • encoding Encoding
    The encoding applied to the contents of the file.

string

A String containing all text in the file.

Asynchronously opens a text file, reads all the text in the file into a string, and then closes the file.

public static Task<string> ReadAllTextAsync(this IFileResourceLink source)

Task<string>

The task object representing the asynchronous operation. The value of the parameter contains s String containing all text in the file.

Section titled “ReadAllTextAsync(IFileResourceLink, Encoding)”

Asynchronously opens a file, reads all text in the file into a string with the specified encoding, and then closes the file.

public static Task<string> ReadAllTextAsync(this IFileResourceLink source, this Encoding encoding)
  • source IFileResourceLink
    The link to the file/file version.
  • encoding Encoding
    The encoding applied to the contents of the file.

Task<string>

The task object representing the asynchronous operation. The value of the parameter contains s String containing all text in the file.

Renames a specified file/directory.

public static FileSystemStructureLink Rename(this FileSystemStructureLink source, this string newName)

FileSystemStructureLink

A FileSystemStructureLink object representing the link to the renamed file/directory.

Section titled “RenameAsync(FileSystemStructureLink, string)”

Asynchronously renames a specified file/directory.

public static Task<FileSystemStructureLink> RenameAsync(this FileSystemStructureLink source, this string newName)

Task<FileSystemStructureLink>

The task object representing the asynchronous operation. The value of the parameter contains a link to the renamed file/directory.

Section titled “SyncWith(DirectoryLink, DirectoryLink, FileSystemSynchronizeMode, FileLinkContentEqualityComparer, FileSystemExceptionResolveDelegate)”

Synchronize source directory with destination directory.

public static void SyncWith(this DirectoryLink source, this DirectoryLink destination, this FileSystemSynchronizeMode mode, this FileLinkContentEqualityComparer comparer, this FileSystemExceptionResolveDelegate exceptionResolver)
Section titled “SyncWith(DirectoryLink, DirectoryLink, FileSystemSynchronizeMode, IEnumerable<string>, FileLinkContentEqualityComparer, FileSystemExceptionResolveDelegate)”

Synchronize source directory with destination directory.

public static void SyncWith(this DirectoryLink source, this DirectoryLink destination, this FileSystemSynchronizeMode mode, this IEnumerable<string> ignoredPaths, this FileLinkContentEqualityComparer comparer, this FileSystemExceptionResolveDelegate exceptionResolver)
Section titled “SyncWith(IFileResourceLink, FileLink, FileSystemSynchronizeMode, FileLinkContentEqualityComparer, FileSystemExceptionResolveDelegate)”

Synchronize source file/file version with destination file.

public static void SyncWith(this IFileResourceLink source, this FileLink destination, this FileSystemSynchronizeMode mode, this FileLinkContentEqualityComparer comparer, this FileSystemExceptionResolveDelegate exceptionResolver)
Section titled “SyncWithAsync(DirectoryLink, DirectoryLink, FileSystemSynchronizeMode, FileLinkContentEqualityComparer, FileSystemExceptionResolveDelegate)”

Asynchronously synchronize source directory with destination directory.

public static Task SyncWithAsync(this DirectoryLink source, this DirectoryLink destination, this FileSystemSynchronizeMode mode, this FileLinkContentEqualityComparer comparer, this FileSystemExceptionResolveDelegate exceptionResolver)

Task

The task object representing the asynchronous operation.

Section titled “SyncWithAsync(DirectoryLink, DirectoryLink, FileSystemSynchronizeMode, IEnumerable<string>, FileLinkContentEqualityComparer, FileSystemExceptionResolveDelegate)”

Asynchronously synchronize source directory with destination directory.

public static Task SyncWithAsync(this DirectoryLink source, this DirectoryLink destination, this FileSystemSynchronizeMode mode, this IEnumerable<string> ignoredPaths, this FileLinkContentEqualityComparer comparer, this FileSystemExceptionResolveDelegate exceptionResolver)

Task

The task object representing the asynchronous operation.

Section titled “SyncWithAsync(IFileResourceLink, FileLink, FileSystemSynchronizeMode, FileLinkContentEqualityComparer, FileSystemExceptionResolveDelegate)”

Asynchronously synchronize source file/file version with destination file.

public static Task SyncWithAsync(this IFileResourceLink source, this FileLink destination, this FileSystemSynchronizeMode mode, this FileLinkContentEqualityComparer comparer, this FileSystemExceptionResolveDelegate exceptionResolver)

Task

The task object representing the asynchronous operation.

Creates a new file, write the contents to the file, and then closes the file. If the target file already exists, it is overwritten.

public static void WriteAllText(this FileLink source, this string content)
  • source FileLink
    The link to the file.
  • content string
    The string to write to the file.

Creates a new file, writes the specified string to the file using the specified encoding, and then closes the file. If the target file already exists, it is overwritten.

public static void WriteAllText(this FileLink source, this string content, this Encoding encoding)
  • source FileLink
    The link to the file.
  • content string
    The string to write to the file.
  • encoding Encoding
    The encoding to apply to the string.

Asynchronously creates a new file, write the contents to the file, and then closes the file. If the target file already exists, it is overwritten.

public static Task WriteAllTextAsync(this FileLink source, this string content)
  • source FileLink
    The link to the file.
  • content string
    The string to write to the file.

Task

The task object representing the asynchronous operation.

Section titled “WriteAllTextAsync(FileLink, string, Encoding)”

Asynchronously creates a new file, writes the specified string to the file using the specified encoding, and then closes the file. If the target file already exists, it is overwritten.

public static Task WriteAllTextAsync(this FileLink source, this string content, this Encoding encoding)
  • source FileLink
    The link to the file.
  • content string
    The string to write to the file.
  • encoding Encoding
    The encoding to apply to the string.

Task

The task object representing the asynchronous operation.