Joutsen  v0.4.1
Public Member Functions | Properties | List of all members
Joutsen.System.IO.Folder Interface Reference

A class representing a folder in the file system. More...

Public Member Functions

void Create ()
 Creates the folder. More...
 
Folder CopyTo (String dstPath, bool recursive, bool overwrite=false, bool copyOnlyContents=false)
 Copies the folder to a different path. More...
 
Folder CopyTo (FilesystemPath dstPath, bool recursive, bool overwrite=false, bool copyOnlyContents=false)
 Copies the folder to a different path. More...
 
Folder MoveTo (string dstPath, bool keepFolder=false)
 Moves the folder to a different location. More...
 
Folder MoveTo (FilesystemPath dstPath, bool keepFolder=false)
 Moves the folder to a different location. More...
 
void Delete (bool recursive=false)
 Deletes the folder from the filesystem. More...
 
Set< FilesystemPathList (string searchPattern="*")
 Lists the content of the folder. More...
 
Set< FolderListFolders (string searchPattern="*")
 Lists the folders contained in this folder. More...
 
Set< FileListFiles (string searchPattern="*")
 Lists the files contained in this folder. More...
 
SCG.IEnumerable< FilesystemPathWalk (string searchPattern="*")
 Walks the filesystem returning one file or folder contained in this folder at a time. More...
 
SCG.IEnumerable< FolderWalkFolders (string searchPattern="*")
 Walks the filesystem returning one subfolder of this folder at a time. More...
 
SCG.IEnumerable< FileWalkFiles (string searchPattern="*")
 Walks the filesystem returning one file contained in this folder at a time. More...
 

Properties

String Name [get]
 The name of the folder. More...
 
Folder Parent [get]
 The path of the parent folder. More...
 
FilesystemPath Path [get]
 The path of the file. More...
 
DateTime LastModificationTime [get]
 The time the folder was last changed. More...
 
DateTime CreationTime [get]
 The time the folder was created. More...
 
bool Exists [get]
 Checks if the folder exists in the filesystem. More...
 
bool IsWritable [get]
 Checks if the folder is writable in the filesystem. More...
 

Detailed Description

A class representing a folder in the file system.

Remarks
The folder does not have to exist. It can also be a potential folder.
Since
0.4.0

Member Function Documentation

◆ CopyTo() [1/2]

Folder Joutsen.System.IO.Folder.CopyTo ( String  dstPath,
bool  recursive,
bool  overwrite = false,
bool  copyOnlyContents = false 
)

Copies the folder to a different path.

Parameters
dstPaththe path to copy the folder to
recursivedetermines if subfolders should be copied as well
overwritedetermines if an existing folder at dstPath should be replaced
Returns
the folder representing the copy
Remarks
Copying a folder is not an atomic operation. Therefore it is likely that parts of the folder are already copied if an error occurs during the copy process. These parts are not cleaned up.

Implemented in Joutsen.System.IO.TemporaryFolder, and Joutsen.System.IO.LocalFolder.

◆ CopyTo() [2/2]

Folder Joutsen.System.IO.Folder.CopyTo ( FilesystemPath  dstPath,
bool  recursive,
bool  overwrite = false,
bool  copyOnlyContents = false 
)

Copies the folder to a different path.

Parameters
dstPaththe path to copy the folder to
recursivedetermines if subfolders should be copied as well
overwritedetermines if an existing folder at dstPath should be replaced
Returns
the folder representing the copy
Exceptions
System.ArgumentNullExceptionif dstPath is null
Remarks
Copying a folder is not an atomic operation. Therefore it is likely that parts of the folder are already copied if an error occurs during the copy process. These parts are not cleaned up.

Implemented in Joutsen.System.IO.TemporaryFolder, and Joutsen.System.IO.LocalFolder.

◆ Create()

void Joutsen.System.IO.Folder.Create ( )

Creates the folder.

Implemented in Joutsen.System.IO.LocalFolder, and Joutsen.System.IO.TemporaryFolder.

◆ Delete()

void Joutsen.System.IO.Folder.Delete ( bool  recursive = false)

Deletes the folder from the filesystem.

Parameters
recursivedetermines if the folder should only be deleted if it is empty or if files and subfolders should be deleted as well

Implemented in Joutsen.System.IO.LocalFolder, and Joutsen.System.IO.TemporaryFolder.

◆ List()

Set<FilesystemPath> Joutsen.System.IO.Folder.List ( string  searchPattern = "*")

Lists the content of the folder.

Parameters
searchPatterncan be used to restrict the result to files and folders matching this pattern
Returns
the files and folders in this folder sorted by their names

Implemented in Joutsen.System.IO.LocalFolder, and Joutsen.System.IO.TemporaryFolder.

◆ ListFiles()

Set<File> Joutsen.System.IO.Folder.ListFiles ( string  searchPattern = "*")

Lists the files contained in this folder.

Parameters
searchPatterncan be used to restrict the result to files matching this pattern
Returns
the files in this folder sorted by their names

Implemented in Joutsen.System.IO.LocalFolder, and Joutsen.System.IO.TemporaryFolder.

◆ ListFolders()

Set<Folder> Joutsen.System.IO.Folder.ListFolders ( string  searchPattern = "*")

Lists the folders contained in this folder.

Parameters
searchPatterncan be used to restrict the result to folders matching this pattern
Returns
the folders in this folder sorted by their names

Implemented in Joutsen.System.IO.LocalFolder, and Joutsen.System.IO.TemporaryFolder.

◆ MoveTo() [1/2]

Folder Joutsen.System.IO.Folder.MoveTo ( string  dstPath,
bool  keepFolder = false 
)

Moves the folder to a different location.

Parameters
dstPaththe path to move the folder to
keepFolderif keepFolder is false the content of the folder will be moved to the new location. If it is false the folder is moved into the folder defined by dstPath
Returns
the Folder representing the moved folder

Implemented in Joutsen.System.IO.LocalFolder, and Joutsen.System.IO.TemporaryFolder.

◆ MoveTo() [2/2]

Folder Joutsen.System.IO.Folder.MoveTo ( FilesystemPath  dstPath,
bool  keepFolder = false 
)

Moves the folder to a different location.

Parameters
dstPaththe path to move the folder to
keepFolderif keepFolder is false the content of the folder will be moved to the new location. If it is false the folder is moved into the folder defined by dstPath
Returns
the Folder representing the moved folder
Exceptions
System.ArgumentNullExceptionif dstPath is null

Implemented in Joutsen.System.IO.LocalFolder, and Joutsen.System.IO.TemporaryFolder.

◆ Walk()

SCG.IEnumerable<FilesystemPath> Joutsen.System.IO.Folder.Walk ( string  searchPattern = "*")

Walks the filesystem returning one file or folder contained in this folder at a time.

Parameters
searchPatterncan be used to restrict the result to files and folders matching this pattern
Returns
the files and folders in this folder one at a time

Implemented in Joutsen.System.IO.LocalFolder, and Joutsen.System.IO.TemporaryFolder.

◆ WalkFiles()

SCG.IEnumerable<File> Joutsen.System.IO.Folder.WalkFiles ( string  searchPattern = "*")

Walks the filesystem returning one file contained in this folder at a time.

Parameters
searchPatterncan be used to restrict the result to files matching this pattern
Returns
the files in this folder one at a time

Implemented in Joutsen.System.IO.LocalFolder, and Joutsen.System.IO.TemporaryFolder.

◆ WalkFolders()

SCG.IEnumerable<Folder> Joutsen.System.IO.Folder.WalkFolders ( string  searchPattern = "*")

Walks the filesystem returning one subfolder of this folder at a time.

Parameters
searchPatterncan be used to restrict the result to folders matching this pattern
Returns
the folders in this folder one at a time

Implemented in Joutsen.System.IO.LocalFolder, and Joutsen.System.IO.TemporaryFolder.

Property Documentation

◆ CreationTime

DateTime Joutsen.System.IO.Folder.CreationTime
get

The time the folder was created.

◆ Exists

bool Joutsen.System.IO.Folder.Exists
get

Checks if the folder exists in the filesystem.

◆ IsWritable

bool Joutsen.System.IO.Folder.IsWritable
get

Checks if the folder is writable in the filesystem.

◆ LastModificationTime

DateTime Joutsen.System.IO.Folder.LastModificationTime
get

The time the folder was last changed.

◆ Name

String Joutsen.System.IO.Folder.Name
get

The name of the folder.

◆ Parent

Folder Joutsen.System.IO.Folder.Parent
get

The path of the parent folder.

◆ Path

FilesystemPath Joutsen.System.IO.Folder.Path
get

The path of the file.