Asposecpplib
System::IO::Directory Class Reference

Contains methods for manipulating directories. This is a static type with no instance services. You should never create instances of it by any means. More...

Public Types

using StringEnumerablePtr = SharedPtr< Collections::Generic::IEnumerable< String > >
 An alias for a shared pointer to IEnumerable object that enumerates over a set of String objects. More...
 

Static Public Member Functions

static ASPOSECPP_SHARED_API void CreateDirectory_ (const String &path)
 Creates all directories in the specified path if those don't exist. More...
 
static ASPOSECPP_SHARED_API void Delete (const String &path, bool recursive=false)
 Removes the specified file or directory. Does not throw. More...
 
static ASPOSECPP_SHARED_API StringEnumerablePtr EnumerateDirectories (const String &path, const String &searchPattern=u"*", SearchOption searchOption=SearchOption::TopDirectoryOnly)
 Searches for the directories that satisfy the specified search criteria either in the specified directory or in the whole directory tree rooted in the specified directory. More...
 
static ASPOSECPP_SHARED_API StringEnumerablePtr EnumerateFiles (const String &path, const String &searchPattern=u"*", SearchOption searchOption=SearchOption::TopDirectoryOnly)
 Searches for the files that satisfy the specified search criteria either in the specified directory or in the whole directory tree rooted in the specified directory. More...
 
static StringEnumerablePtr EnumerateFileSystemEntries (const String &path, const String &searchPattern=u"*", SearchOption searchOption=SearchOption::TopDirectoryOnly)
 Searches for the files and directories that satisfy the specified search criteria either in the specified directory or in the whole directory tree rooted in the specified directory. More...
 
static ASPOSECPP_SHARED_API ArrayPtr< StringGetDirectories (const String &path, const String &searchPattern=u"*", SearchOption searchOption=SearchOption::TopDirectoryOnly)
 Searches for the directories that satisfy the specified search criteria either in the specified directory or in the whole directory tree rooted in the specified directory. More...
 
static ASPOSECPP_SHARED_API ArrayPtr< StringGetFiles (const String &path, const String &searchPattern=u"*", SearchOption searchOption=SearchOption::TopDirectoryOnly)
 Searches for the files that satisfy the specified search criteria either in the specified directory or in the whole directory tree rooted in the specified directory. More...
 
static ASPOSECPP_SHARED_API ArrayPtr< StringGetFileSystemEntries (const String &path, const String &searchPattern=u"*", SearchOption searchOption=SearchOption::TopDirectoryOnly)
 Searches for the files and directories that satisfy the specified search criteria either in the specified directory or in the whole directory tree rooted in the specified directory. More...
 
static ASPOSECPP_SHARED_API ArrayPtr< StringGetLogicalDrives ()
 NOT IMPLEMENTED. More...
 
static ASPOSECPP_SHARED_API bool Exists (const String &path)
 Determines if the specified path refers to existing directory. More...
 
static ASPOSECPP_SHARED_API DateTime GetCreationTime (const String &path)
 Returns the creation time of the specified entity as local time. More...
 
static ASPOSECPP_SHARED_API DateTime GetCreationTimeUtc (const String &path)
 Returns the creation time of the specified entity as UTC time. More...
 
static ASPOSECPP_SHARED_API DateTime GetLastAccessTime (const String &path)
 Returns the last access time of the specified entity as local time. More...
 
static ASPOSECPP_SHARED_API DateTime GetLastAccessTimeUtc (const String &path)
 Returns the last access time of the specified entity as UTC time. More...
 
static ASPOSECPP_SHARED_API DateTime GetLastWriteTime (const String &path)
 Returns the last write time of the specified entity as local time. More...
 
static ASPOSECPP_SHARED_API DateTime GetLastWriteTimeUtc (const String &path)
 Returns the last write time of the specified entity as UTC time. More...
 
static ASPOSECPP_SHARED_API void SetCreationTime (const String &path, DateTime date)
 Sets the creation time of the specified entity as local time. More...
 
static ASPOSECPP_SHARED_API void SetCreationTimeUtc (const String &path, DateTime date)
 Sets the creation time of the specified entity as UTC time. More...
 
static ASPOSECPP_SHARED_API void SetLastAccessTime (const String &path, DateTime date)
 Sets the last access time of the specified entity as local time. More...
 
static ASPOSECPP_SHARED_API void SetLastAccessTimeUtc (const String &path, DateTime date)
 Sets the last access time of the specified entity as UTC time. More...
 
static ASPOSECPP_SHARED_API void SetLastWriteTime (const String &path, DateTime date)
 Sets the last write time of the specified entity as local time. More...
 
static ASPOSECPP_SHARED_API void SetLastWriteTimeUtc (const String &path, DateTime date)
 Sets the last write time of the specified entity as UTC time. More...
 
static ASPOSECPP_SHARED_API String GetCurrentDirectory ()
 Returns the full name (including path) of the current directory. More...
 
static ASPOSECPP_SHARED_API String GetDirectoryRoot (const String &path)
 Returns the root directory of the specified path. More...
 
static ASPOSECPP_SHARED_API DirectoryInfoPtr GetParent (const String &path)
 Returns a shared pointer to DirectoryInfo object representing the parent directory of the specified entity. More...
 
static ASPOSECPP_SHARED_API void Move (const String &sourceDirName, const String &destDirName)
 Moves the specified entity to the new location. If the entity to move is a directory, it is moved with all its content. More...
 
static ASPOSECPP_SHARED_API void SetCurrentDirectory (const String &path)
 Sets the current directory. More...
 

Detailed Description

Contains methods for manipulating directories. This is a static type with no instance services. You should never create instances of it by any means.

Member Typedef Documentation

◆ StringEnumerablePtr

An alias for a shared pointer to IEnumerable object that enumerates over a set of String objects.

Member Function Documentation

◆ CreateDirectory_()

static ASPOSECPP_SHARED_API void System::IO::Directory::CreateDirectory_ ( const String path)
static

Creates all directories in the specified path if those don't exist.

Parameters
pathThe path containing the directories to create

◆ Delete()

static ASPOSECPP_SHARED_API void System::IO::Directory::Delete ( const String path,
bool  recursive = false 
)
static

Removes the specified file or directory. Does not throw.

Parameters
pathThe path to the directory or file to be removed
recursiveIf path spacifies a non-empty directory then recursive specifies if if all directory's content should be removed recursively; if the directory specified by path is not empty and recursive is 'false' then the operation fails

◆ EnumerateDirectories()

static ASPOSECPP_SHARED_API StringEnumerablePtr System::IO::Directory::EnumerateDirectories ( const String path,
const String searchPattern = u"*",
SearchOption  searchOption = SearchOption::TopDirectoryOnly 
)
static

Searches for the directories that satisfy the specified search criteria either in the specified directory or in the whole directory tree rooted in the specified directory.

Parameters
pathFull or relative path to the directory to search in
searchPatternThe name pattern of the directories to search for
searchOptionSpecifies whether the search has to be performed in the specified directory only or in the whole directory tree rooted in the specified directory
Returns
The enumerable collection of full paths of the found directories whose names match searchPattern

◆ EnumerateFiles()

static ASPOSECPP_SHARED_API StringEnumerablePtr System::IO::Directory::EnumerateFiles ( const String path,
const String searchPattern = u"*",
SearchOption  searchOption = SearchOption::TopDirectoryOnly 
)
static

Searches for the files that satisfy the specified search criteria either in the specified directory or in the whole directory tree rooted in the specified directory.

Parameters
pathFull or relative path to the directory to search in
searchPatternThe name pattern of the files to search for
searchOptionSpecifies whether the search has to be performed in the specified directory only or in the whole directory tree rooted in the specified directory
Returns
The enumerable collection of full paths of the found files whose names match searchPattern

◆ EnumerateFileSystemEntries()

static StringEnumerablePtr System::IO::Directory::EnumerateFileSystemEntries ( const String path,
const String searchPattern = u"*",
SearchOption  searchOption = SearchOption::TopDirectoryOnly 
)
static

Searches for the files and directories that satisfy the specified search criteria either in the specified directory or in the whole directory tree rooted in the specified directory.

Parameters
pathFull or relative path to the directory to search in
searchPatternThe name pattern of the files and directories to search for
searchOptionSpecifies whether the search has to be performed in the specified directory only or in the whole directory tree rooted in the specified directory
Returns
The enumerable collection of full paths of the found files and directories whose names match searchPattern

◆ Exists()

static ASPOSECPP_SHARED_API bool System::IO::Directory::Exists ( const String path)
static

Determines if the specified path refers to existing directory.

Parameters
pathThe path to check
Returns
True if the specified path refers to existing directory, otherwise - false

◆ GetCreationTime()

static ASPOSECPP_SHARED_API DateTime System::IO::Directory::GetCreationTime ( const String path)
static

Returns the creation time of the specified entity as local time.

Parameters
pathThe entity whose creating time to retrieve
Returns
A DateTime object representing the creation time of the specified entity as local time

◆ GetCreationTimeUtc()

static ASPOSECPP_SHARED_API DateTime System::IO::Directory::GetCreationTimeUtc ( const String path)
static

Returns the creation time of the specified entity as UTC time.

Parameters
pathThe entity whose creating time to retrieve
Returns
A DateTime object representing the creation time of the specified entity as UTC time

◆ GetCurrentDirectory()

static ASPOSECPP_SHARED_API String System::IO::Directory::GetCurrentDirectory ( )
static

Returns the full name (including path) of the current directory.

◆ GetDirectories()

static ASPOSECPP_SHARED_API ArrayPtr<String> System::IO::Directory::GetDirectories ( const String path,
const String searchPattern = u"*",
SearchOption  searchOption = SearchOption::TopDirectoryOnly 
)
static

Searches for the directories that satisfy the specified search criteria either in the specified directory or in the whole directory tree rooted in the specified directory.

Parameters
pathFull or relative path to the directory to search in
searchPatternThe name pattern of the directories to search for
searchOptionSpecifies whether the search has to be performed in the specified directory only or in the whole directory tree rooted in the specified directory
Returns
An array of full paths of the found directories whose names match searchPattern

◆ GetDirectoryRoot()

static ASPOSECPP_SHARED_API String System::IO::Directory::GetDirectoryRoot ( const String path)
static

Returns the root directory of the specified path.

Parameters
pathA path from which a root directory is to be obtained
Returns
The name of the root directory in path

◆ GetFiles()

static ASPOSECPP_SHARED_API ArrayPtr<String> System::IO::Directory::GetFiles ( const String path,
const String searchPattern = u"*",
SearchOption  searchOption = SearchOption::TopDirectoryOnly 
)
static

Searches for the files that satisfy the specified search criteria either in the specified directory or in the whole directory tree rooted in the specified directory.

Parameters
pathFull or relative path to the directory to search in
searchPatternThe name pattern of the files to search for
searchOptionSpecifies whether the search has to be performed in the specified directory only or in the whole directory tree rooted in the specified directory
Returns
An array of full paths of the found files whose names match searchPattern

◆ GetFileSystemEntries()

static ASPOSECPP_SHARED_API ArrayPtr<String> System::IO::Directory::GetFileSystemEntries ( const String path,
const String searchPattern = u"*",
SearchOption  searchOption = SearchOption::TopDirectoryOnly 
)
static

Searches for the files and directories that satisfy the specified search criteria either in the specified directory or in the whole directory tree rooted in the specified directory.

Parameters
pathFull or relative path to the directory to search in
searchPatternThe name pattern of the files and directories to search for
searchOptionSpecifies whether the search has to be performed in the specified directory only or in the whole directory tree rooted in the specified directory
Returns
An array of full paths of the found files and directories whose names match searchPattern

◆ GetLastAccessTime()

static ASPOSECPP_SHARED_API DateTime System::IO::Directory::GetLastAccessTime ( const String path)
static

Returns the last access time of the specified entity as local time.

Parameters
pathThe entity whose last access time to retrieve
Returns
A DateTime object representing the last access time of the specified entity as local time

◆ GetLastAccessTimeUtc()

static ASPOSECPP_SHARED_API DateTime System::IO::Directory::GetLastAccessTimeUtc ( const String path)
static

Returns the last access time of the specified entity as UTC time.

Parameters
pathThe entity whose last access time to retrieve
Returns
A DateTime object representing the last access time of the specified entity as UTC time

◆ GetLastWriteTime()

static ASPOSECPP_SHARED_API DateTime System::IO::Directory::GetLastWriteTime ( const String path)
static

Returns the last write time of the specified entity as local time.

Parameters
pathThe entity whose last write time to retrieve
Returns
A DateTime object representing the last write time of the specified entity as local time

◆ GetLastWriteTimeUtc()

static ASPOSECPP_SHARED_API DateTime System::IO::Directory::GetLastWriteTimeUtc ( const String path)
static

Returns the last write time of the specified entity as UTC time.

Parameters
pathThe entity whose last write time to retrieve
Returns
A DateTime object representing the last write time of the specified entity as UTC time

◆ GetLogicalDrives()

static ASPOSECPP_SHARED_API ArrayPtr<String> System::IO::Directory::GetLogicalDrives ( )
static

NOT IMPLEMENTED.

Exceptions
IOExceptionAlways

◆ GetParent()

static ASPOSECPP_SHARED_API DirectoryInfoPtr System::IO::Directory::GetParent ( const String path)
static

Returns a shared pointer to DirectoryInfo object representing the parent directory of the specified entity.

Parameters
pathThe path to the entity whose parent is to be obtained
Returns
A shared pointer to DirectoryInfo object representing the parent directory of the entity specified by path

◆ Move()

static ASPOSECPP_SHARED_API void System::IO::Directory::Move ( const String sourceDirName,
const String destDirName 
)
static

Moves the specified entity to the new location. If the entity to move is a directory, it is moved with all its content.

Parameters
sourceDirNameA direcotry or file to move
destDirNameThe new location of sourceDirName

◆ SetCreationTime()

static ASPOSECPP_SHARED_API void System::IO::Directory::SetCreationTime ( const String path,
DateTime  date 
)
static

Sets the creation time of the specified entity as local time.

Parameters
pathThe entity whose creating time to set
dateA DateTime object representing the time to set as local time

◆ SetCreationTimeUtc()

static ASPOSECPP_SHARED_API void System::IO::Directory::SetCreationTimeUtc ( const String path,
DateTime  date 
)
static

Sets the creation time of the specified entity as UTC time.

Parameters
pathThe entity whose creating time to set
dateA DateTime object representing the time to set as UTC time

◆ SetCurrentDirectory()

static ASPOSECPP_SHARED_API void System::IO::Directory::SetCurrentDirectory ( const String path)
static

Sets the current directory.

Parameters
pathThe path to the directory to make current

◆ SetLastAccessTime()

static ASPOSECPP_SHARED_API void System::IO::Directory::SetLastAccessTime ( const String path,
DateTime  date 
)
static

Sets the last access time of the specified entity as local time.

Parameters
pathThe entity whose last access time to set
dateA DateTime object representing the time to set as local time

◆ SetLastAccessTimeUtc()

static ASPOSECPP_SHARED_API void System::IO::Directory::SetLastAccessTimeUtc ( const String path,
DateTime  date 
)
static

Sets the last access time of the specified entity as UTC time.

Parameters
pathThe entity whose last access time to set
dateA DateTime object representing the time to set as UTC time

◆ SetLastWriteTime()

static ASPOSECPP_SHARED_API void System::IO::Directory::SetLastWriteTime ( const String path,
DateTime  date 
)
static

Sets the last write time of the specified entity as local time.

Parameters
pathThe entity whose last write time to set
dateA DateTime object representing the time to set as local time

◆ SetLastWriteTimeUtc()

static ASPOSECPP_SHARED_API void System::IO::Directory::SetLastWriteTimeUtc ( const String path,
DateTime  date 
)
static

Sets the last write time of the specified entity as UTC time.

Parameters
pathThe entity whose last write time to set
dateA DateTime object representing the time to set as UTC time