Class FileSystemDirectory
Represents a directory item in a file system. This class is NOT thread-safe
Inheritance
System.Object
FileSystemDirectory
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Azos.dll
Syntax
public sealed class FileSystemDirectory : FileSystemSessionItem, IDisposable, INamed
Constructors
FileSystemDirectory(FileSystemSession, String, String, IFileSystemHandle)
Internal method that should not be called by developers
Declaration
public FileSystemDirectory(FileSystemSession session, string parentPath, string name, IFileSystemHandle handle)
Parameters
Properties
FileNames
Returns file names contained in this directory
Declaration
public IEnumerable<string> FileNames { get; }
Property Value
Type |
Description |
System.Collections.Generic.IEnumerable<System.String> |
|
Item[String]
Navigates to the specified path relative to this directory
Declaration
public FileSystemSessionItem this[string path] { get; }
Parameters
Type |
Name |
Description |
System.String |
path |
Path relative to this directory to navigate to
|
Property Value
RecursiveFileNames
Returns file names contained in this directory and all subdirectories
Declaration
public IEnumerable<string> RecursiveFileNames { get; }
Property Value
Type |
Description |
System.Collections.Generic.IEnumerable<System.String> |
|
RecursiveSubDirectoryNames
Returns directory names contained in this directory and all subdirectories
Declaration
public IEnumerable<string> RecursiveSubDirectoryNames { get; }
Property Value
Type |
Description |
System.Collections.Generic.IEnumerable<System.String> |
|
SubDirectoryNames
Returns directory names contained in this directory
Declaration
public IEnumerable<string> SubDirectoryNames { get; }
Property Value
Type |
Description |
System.Collections.Generic.IEnumerable<System.String> |
|
Methods
CreateDirectory(String)
Creates a directory in this directory
Declaration
public FileSystemDirectory CreateDirectory(string name)
Parameters
Type |
Name |
Description |
System.String |
name |
|
Returns
CreateDirectoryAsync(String)
Declaration
public Task<FileSystemDirectory> CreateDirectoryAsync(string name)
Parameters
Type |
Name |
Description |
System.String |
name |
|
Returns
CreateFile(String, Int32)
Creates a new file optionally pre-allocating te specified number of bytes
Declaration
public FileSystemFile CreateFile(string name, int size = 0)
Parameters
Type |
Name |
Description |
System.String |
name |
|
System.Int32 |
size |
|
Returns
CreateFile(String, String, Boolean)
Puts local existing file into file system
Declaration
public FileSystemFile CreateFile(string name, string localFilePath, bool readOnly = false)
Parameters
Type |
Name |
Description |
System.String |
name |
File system file name
|
System.String |
localFilePath |
Local system file name
|
System.Boolean |
readOnly |
Indicates whether the newly created file should be readonly
|
Returns
CreateFileAsync(String, Int32)
Declaration
public Task<FileSystemFile> CreateFileAsync(string name, int size = 0)
Parameters
Type |
Name |
Description |
System.String |
name |
|
System.Int32 |
size |
|
Returns
CreateFileAsync(String, String, Boolean)
Declaration
public Task<FileSystemFile> CreateFileAsync(string name, string localFilePath, bool readOnly = false)
Parameters
Type |
Name |
Description |
System.String |
name |
|
System.String |
localFilePath |
|
System.Boolean |
readOnly |
|
Returns
DeepCopyTo(FileSystemDirectory, FileSystemDirectory.DirCopyFlags, Int32, Func<FileSystemSessionItem, Boolean>, Func<FileSystemSessionItem, Boolean>)
Performs a deep copy of this directory into another directory that may belong to a different file system.
This method allows to copy directory trees between different file systems i.e. from SVN into AmazonS3 or local file system etc.
Declaration
public void DeepCopyTo(FileSystemDirectory target, FileSystemDirectory.DirCopyFlags flags = FileSystemDirectory.DirCopyFlags.Directories | FileSystemDirectory.DirCopyFlags.Files | FileSystemDirectory.DirCopyFlags.Security | FileSystemDirectory.DirCopyFlags.Metadata | FileSystemDirectory.DirCopyFlags.Timestamps | FileSystemDirectory.DirCopyFlags.Readonly | FileSystemDirectory.DirCopyFlags.FilesAndDirsOnly | FileSystemDirectory.DirCopyFlags.All, int bufferSize = 65536, Func<FileSystemSessionItem, bool> filter = null, Func<FileSystemSessionItem, bool> cancel = null)
Parameters
Type |
Name |
Description |
FileSystemDirectory |
target |
Target directory where the files will be placed. It's name does not have to be the same as the source's name
|
FileSystemDirectory.DirCopyFlags |
flags |
Copy flags that specify what to copy
|
System.Int32 |
bufferSize |
Copy buffer size
|
System.Func<FileSystemSessionItem, System.Boolean> |
filter |
Optional filter function
|
System.Func<FileSystemSessionItem, System.Boolean> |
cancel |
Optional cancellation function. Return true to abort copying
|
DeepCopyToAsync(FileSystemDirectory, FileSystemDirectory.DirCopyFlags, Int32, Func<FileSystemSessionItem, Boolean>, Func<FileSystemSessionItem, Boolean>)
Async version of DeepCopyTo(...)
Declaration
public Task DeepCopyToAsync(FileSystemDirectory target, FileSystemDirectory.DirCopyFlags flags = FileSystemDirectory.DirCopyFlags.Directories | FileSystemDirectory.DirCopyFlags.Files | FileSystemDirectory.DirCopyFlags.Security | FileSystemDirectory.DirCopyFlags.Metadata | FileSystemDirectory.DirCopyFlags.Timestamps | FileSystemDirectory.DirCopyFlags.Readonly | FileSystemDirectory.DirCopyFlags.FilesAndDirsOnly | FileSystemDirectory.DirCopyFlags.All, int bufferSize = 65536, Func<FileSystemSessionItem, bool> filter = null, Func<FileSystemSessionItem, bool> cancel = null)
Parameters
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
GetFile(String)
Gets file in this directory or null if it does not exist or not a file
Declaration
public FileSystemFile GetFile(string name)
Parameters
Type |
Name |
Description |
System.String |
name |
|
Returns
GetFileAsync(String)
Declaration
public Task<FileSystemFile> GetFileAsync(string name)
Parameters
Type |
Name |
Description |
System.String |
name |
|
Returns
GetFileNamesAsync()
Async version of FileNames
Declaration
public Task<IEnumerable<string>> GetFileNamesAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<System.String>> |
|
GetItemAsync(String)
Async version of Item(string)
Declaration
public Task<FileSystemSessionItem> GetItemAsync(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
|
Returns
GetRecursiveFileNamesAsync()
Async version of RecursiveFileNames
Declaration
public Task<IEnumerable<string>> GetRecursiveFileNamesAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<System.String>> |
|
GetRecursiveSubDirectoryNamesAsync()
Async version of RecursiveSubDirectoryNames
Declaration
public Task<IEnumerable<string>> GetRecursiveSubDirectoryNamesAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<System.String>> |
|
GetSubDirectory(String)
Gets subdirectory in this directory or null if it does not exist or not a directory
Declaration
public FileSystemDirectory GetSubDirectory(string name)
Parameters
Type |
Name |
Description |
System.String |
name |
|
Returns
GetSubDirectoryAsync(String)
Declaration
public Task<FileSystemDirectory> GetSubDirectoryAsync(string name)
Parameters
Type |
Name |
Description |
System.String |
name |
|
Returns
GetSubDirectoryNamesAsync()
Async version of SubDirectoryNames
Declaration
public Task<IEnumerable<string>> GetSubDirectoryNamesAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<System.String>> |
|
Implements
System.IDisposable
Extension Methods