PLCnext API Documentation 23.6.0.37
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Arp::System::Commons::Io::Directory Class Reference

API for manipulation and examiniation of directories of a file system. More...

#include <Directory.hpp>

Public Member Functions

 Directory (const Directory &arg)=delete
 
Directoryoperator= (const Directory &arg)=delete
 
 ARP_DEPRECATED ("Please use Directory::Move() instead of Directory::Rename().") static void Rename(const String &sourcePath
 

Static Public Member Functions

static bool Exists (const String &path)
 Checks if a specific directory exists. More...
 
static void Create (const String &path)
 Creates a new directory. After successful operation, the synchronization of the file system will be forced. More...
 
static void Create (const String &path, bool sync)
 Creates a new directory. More...
 
static void Delete (const String &path)
 Deletes a directory. After successful operation, the synchronization of the file system will be forced. More...
 
static void Delete (const String &path, bool sync)
 Deletes a directory. More...
 
static void Clear (const String &path)
 Deletes the complete content of a directory. After successful operation, the synchronization of the file system will be forced. More...
 
static void Clear (const String &path, bool sync)
 Deletes the complete content of a directory. More...
 
static void Copy (const String &sourcePath, const String &destinationPath, bool clear=false)
 Copies a directory and its content to a new location. After successful operation, the synchronization of the file system will be forced. More...
 
static void Copy (const String &sourcePath, const String &destinationPath, bool clear, bool sync)
 Copies a directory and its content to a new location. More...
 
static void Move (const String &sourcePath, const String &destinationPath, bool overwrite=false)
 Moves a directory and its content to a new location. After successful operation, the synchronization of the file system will be forced. More...
 
static void Move (const String &sourcePath, const String &destinationPath, bool overwrite, bool sync)
 Moves a directory and its content to a new location. More...
 
static String GetCurrent (void)
 Returns the fully qualified path of the current directory. More...
 
static void SyncAll (void)
 Force global file system synchronization.
 
static void Sync (const String &path)
 Force file system synchronization for the given file. More...
 
static IEnumerator< String >::Ptr GetEnumerator (const String &path, bool recursive=false)
 Returns an enumerator listing the content of a directory. More...
 
static IEnumerator< String >::Ptr GetEnumerator (const String &path, const char *searchPattern, bool recursive=false)
 Returns an enumerator listing the content of a directory that matches the search pattern. More...
 
static IEnumerator< String >::Ptr GetFileEnumerator (const String &path, bool recursive=false)
 Like Arp::System::Commons::Io::Directory::GetEnumerator but only files are listed by the returned enumeration object. More...
 
static IEnumerator< String >::Ptr GetFileEnumerator (const String &path, const char *searchPattern, bool recursive=false)
 Like Arp::System::Commons::Io::Directory::GetEnumerator but only files are listed by the returned enumeration object. More...
 
static IEnumerator< String >::Ptr GetDirectoryEnumerator (const String &path, bool recursive=false)
 Like Arp::System::Commons::Io::Directory::GetEnumerator but only directories are listed by the returned enumeration object. More...
 
static IEnumerator< String >::Ptr GetDirectoryEnumerator (const String &path, const char *searchPattern, bool recursive=false)
 Like Arp::System::Commons::Io::Directory::GetEnumerator but only directories are listed by the returned enumeration object. More...
 
static IEnumerator< String >::Ptr TryGetEnumerator (const String &path, bool recursive=false)
 Like Arp::System::Commons::Io::Directory::GetEnumerator but will not throw any exception. More...
 
static IEnumerator< String >::Ptr TryGetEnumerator (const String &path, const char *searchPattern, bool recursive=false)
 Like Arp::System::Commons::Io::Directory::GetEnumerator but will not throw any exception. More...
 
static IEnumerator< String >::Ptr TryGetFileEnumerator (const String &path, bool recursive=false)
 Like Arp::System::Commons::Io::Directory::GetFileEnumerator but will not throw any exception. More...
 
static IEnumerator< String >::Ptr TryGetFileEnumerator (const String &path, const char *searchPattern, bool recursive=false)
 Like Arp::System::Commons::Io::Directory::GetFileEnumerator but will not throw any exception. More...
 
static IEnumerator< String >::Ptr TryGetDirectoryEnumerator (const String &path, bool recursive=false)
 Like Arp::System::Commons::Io::Directory::GetDirectoryEnumerator but will not throw any exception. More...
 
static IEnumerator< String >::Ptr TryGetDirectoryEnumerator (const String &path, const char *searchPattern, bool recursive=false)
 Like Arp::System::Commons::Io::Directory::GetDirectoryEnumerator but will not throw any exception. More...
 

Public Attributes

const StringdestinationPath
 

Detailed Description

API for manipulation and examiniation of directories of a file system.

Member Function Documentation

◆ ARP_DEPRECATED()

Arp::System::Commons::Io::Directory::ARP_DEPRECATED ( "Please use Directory::Move() instead of Directory::Rename()."  ) const &
Parameters
sourcePathFully qualified path of directory/file to rename.
destinationPathFully qualified path of destination.
Exceptions
Arp::System::Commons::Io::AlreadyExistsExceptionif the destination folder/file already exists
Arp::System::Commons::Io::NotExistExceptionif the source folder/file does not exist

</deprecated>

◆ Clear() [1/2]

static void Arp::System::Commons::Io::Directory::Clear ( const String path)
static

Deletes the complete content of a directory. After successful operation, the synchronization of the file system will be forced.

Parameters
pathFully qualified path of directory to clear.
Exceptions
Arp::System::Commons::Io::NotExistExceptionif the directory to delete does not exist.
Arp::System::Commons::Io::AccessDeniedExceptionif the process does not have permission to delete the directory.

◆ Clear() [2/2]

static void Arp::System::Commons::Io::Directory::Clear ( const String path,
bool  sync 
)
static

Deletes the complete content of a directory.

Parameters
pathFully qualified path of directory to clear.
syncIf set to true, the synchronization of the file system is forced after successful operation.
Exceptions
Arp::System::Commons::Io::NotExistExceptionif the directory to delete does not exist.
Arp::System::Commons::Io::AccessDeniedExceptionif the process does not have permission to delete the directory.

◆ Copy() [1/2]

static void Arp::System::Commons::Io::Directory::Copy ( const String sourcePath,
const String destinationPath,
bool  clear,
bool  sync 
)
static

Copies a directory and its content to a new location.

Parameters
sourcePathFully qualified path of directory to copy.
destinationPathFully qualified path of destination.
clearIf set to true and the destination folder already exists, it will be deleted beforehand. Default value is false.
syncIf set to true, the synchronization of the file system is forced after successful operation.
Exceptions
Arp::System::Commons::Io::AlreadyExistsExceptionif the destination folder already exists and parameter clear is set to false.
Arp::System::Commons::Io::AccessDeniedExceptionif the destination folder already exists and can not be deleted in case clear is set to true.

◆ Copy() [2/2]

static void Arp::System::Commons::Io::Directory::Copy ( const String sourcePath,
const String destinationPath,
bool  clear = false 
)
static

Copies a directory and its content to a new location. After successful operation, the synchronization of the file system will be forced.

Parameters
sourcePathFully qualified path of directory to copy.
destinationPathFully qualified path of destination.
clearIf set to true and the destination folder already exists, it will be deleted beforehand. Default value is false.
Exceptions
Arp::System::Commons::Io::AlreadyExistsExceptionif the destination folder already exists and parameter clear is set to false.
Arp::System::Commons::Io::AccessDeniedExceptionif the destination folder already exists and can not be deleted in case clear is set to true.

◆ Create() [1/2]

static void Arp::System::Commons::Io::Directory::Create ( const String path)
static

Creates a new directory. After successful operation, the synchronization of the file system will be forced.

Parameters
pathThe fully qualified path to the directory to create.
Exceptions
Arp::System::Commons::Io::AccessDeniedExceptionif the application lacks the rights to create a new directory at the specified location.
Arp::System::Commons::Io::AlreadyExistsExceptionif a file or directory with the specified path already exists.

◆ Create() [2/2]

static void Arp::System::Commons::Io::Directory::Create ( const String path,
bool  sync 
)
static

Creates a new directory.

Parameters
pathThe fully qualified path to the directory to create.
syncIf set to true, the synchronization of the file system is forced after successful operation.
Exceptions
Arp::System::Commons::Io::AccessDeniedExceptionif the application lacks the rights to create a new directory at the specified location.
Arp::System::Commons::Io::AlreadyExistsExceptionif a file or directory with the specified path already exists.

◆ Delete() [1/2]

static void Arp::System::Commons::Io::Directory::Delete ( const String path)
static

Deletes a directory. After successful operation, the synchronization of the file system will be forced.

Parameters
pathFully qualified path of directory to delete.
Exceptions
Arp::System::Commons::Io::NotExistExceptionif the directory to delete does not exist.
Arp::System::Commons::Io::AccessDeniedExceptionif the process does not have permission to delete the directory.

◆ Delete() [2/2]

static void Arp::System::Commons::Io::Directory::Delete ( const String path,
bool  sync 
)
static

Deletes a directory.

Parameters
pathFully qualified path of directory to delete.
syncIf set to true, the synchronization of the file system is forced after successful operation.
Exceptions
Arp::System::Commons::Io::NotExistExceptionif the directory to delete does not exist.
Arp::System::Commons::Io::AccessDeniedExceptionif the process does not have permission to delete the directory.

◆ Exists()

static bool Arp::System::Commons::Io::Directory::Exists ( const String path)
static

Checks if a specific directory exists.

Parameters
pathFully qualified path of directory to be checked.

◆ GetCurrent()

static String Arp::System::Commons::Io::Directory::GetCurrent ( void  )
static

Returns the fully qualified path of the current directory.

Returns
Fully qualified path of current directory.

◆ GetDirectoryEnumerator() [1/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::GetDirectoryEnumerator ( const String path,
bool  recursive = false 
)
inlinestatic

Like Arp::System::Commons::Io::Directory::GetEnumerator but only directories are listed by the returned enumeration object.

Parameters
pathThe fully qualified path of the directory to list the content of.
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.

s

Returns
A pointer to a valid enumeration object.

◆ GetDirectoryEnumerator() [2/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::GetDirectoryEnumerator ( const String path,
const char *  searchPattern,
bool  recursive = false 
)
inlinestatic

Like Arp::System::Commons::Io::Directory::GetEnumerator but only directories are listed by the returned enumeration object.

Parameters
pathThe fully qualified path of the directory to list the content of.
searchPatternA pattern each directory content must match to be included inside the enumeration object. E.g. "*.cpp".
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.
Returns
A pointer to a valid enumeration object.

◆ GetEnumerator() [1/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::GetEnumerator ( const String path,
bool  recursive = false 
)
inlinestatic

Returns an enumerator listing the content of a directory.

Parameters
pathThe fully qualified path of the directory to list the content of.
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.
Returns
A pointer to a valid enumeration object.

◆ GetEnumerator() [2/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::GetEnumerator ( const String path,
const char *  searchPattern,
bool  recursive = false 
)
inlinestatic

Returns an enumerator listing the content of a directory that matches the search pattern.

Parameters
pathThe fully qualified path of the directory to list the content of.
searchPatternA pattern each directory content must match to be included inside the enumeration object. E.g. "*.cpp".
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.
Returns
A pointer to a valid enumeration object.

◆ GetFileEnumerator() [1/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::GetFileEnumerator ( const String path,
bool  recursive = false 
)
inlinestatic

Like Arp::System::Commons::Io::Directory::GetEnumerator but only files are listed by the returned enumeration object.

Parameters
pathThe fully qualified path of the directory to list the content of.
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.

s

Returns
A pointer to a valid enumeration object.

◆ GetFileEnumerator() [2/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::GetFileEnumerator ( const String path,
const char *  searchPattern,
bool  recursive = false 
)
inlinestatic

Like Arp::System::Commons::Io::Directory::GetEnumerator but only files are listed by the returned enumeration object.

Parameters
pathThe fully qualified path of the directory to list the content of.
searchPatternA pattern each directory content must match to be included inside the enumeration object. E.g. "*.cpp".
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.
Returns
A pointer to a valid enumeration object.

◆ Move() [1/2]

static void Arp::System::Commons::Io::Directory::Move ( const String sourcePath,
const String destinationPath,
bool  overwrite,
bool  sync 
)
static

Moves a directory and its content to a new location.

Parameters
sourcePathFully qualified path of directory to move.
destinationPathFully qualified path of destination.
overwriteIf set to true and destinationPath already exists, it will be overwritten.
syncIf set to true, the synchronization of the file system is forced after successful operation.
Exceptions
Arp::System::Commons::Io::AlreadyExistsExceptionif the destination folder already exists and parameter clear is set to false.
Arp::System::Commons::Io::AccessDeniedExceptionif the destination folder already exists and can not be deleted in case clear is set to true.

◆ Move() [2/2]

static void Arp::System::Commons::Io::Directory::Move ( const String sourcePath,
const String destinationPath,
bool  overwrite = false 
)
static

Moves a directory and its content to a new location. After successful operation, the synchronization of the file system will be forced.

Parameters
sourcePathFully qualified path of directory to move.
destinationPathFully qualified path of destination.
overwriteIf set to true and destinationPath already exists, it will be overwritten.
Exceptions
Arp::System::Commons::Io::AlreadyExistsExceptionif the destination folder already exists and parameter clear is set to false.
Arp::System::Commons::Io::AccessDeniedExceptionif the destination folder already exists and can not be deleted in case clear is set to true.

◆ Sync()

static void Arp::System::Commons::Io::Directory::Sync ( const String path)
static

Force file system synchronization for the given file.

Parameters
pathPath to the file to be synchronized.

◆ TryGetDirectoryEnumerator() [1/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::TryGetDirectoryEnumerator ( const String path,
bool  recursive = false 
)
inlinestatic

Like Arp::System::Commons::Io::Directory::GetDirectoryEnumerator but will not throw any exception.

Parameters
pathThe fully qualified path of the directory to list the content of.
searchPatternA pattern each directory content must match to be included inside the enumeration object. E.g. "*.cpp".
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.
Returns
A pointer to a valid enumeration object or an empty enumerator object in case the directory does not exists.

◆ TryGetDirectoryEnumerator() [2/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::TryGetDirectoryEnumerator ( const String path,
const char *  searchPattern,
bool  recursive = false 
)
inlinestatic

Like Arp::System::Commons::Io::Directory::GetDirectoryEnumerator but will not throw any exception.

Parameters
pathThe fully qualified path of the directory to list the content of.
searchPatternA pattern each directory content must match to be included inside the enumeration object. E.g. "*.cpp".
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.
Returns
A pointer to a valid enumeration object or an empty enumerator object in case the directory does not exists.

◆ TryGetEnumerator() [1/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::TryGetEnumerator ( const String path,
bool  recursive = false 
)
inlinestatic

Like Arp::System::Commons::Io::Directory::GetEnumerator but will not throw any exception.

Parameters
pathThe fully qualified path of the directory to list the content of.
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.
Returns
A pointer to a valid enumeration object or an empty enumerator object in case the directory does not exists.

◆ TryGetEnumerator() [2/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::TryGetEnumerator ( const String path,
const char *  searchPattern,
bool  recursive = false 
)
inlinestatic

Like Arp::System::Commons::Io::Directory::GetEnumerator but will not throw any exception.

Parameters
pathThe fully qualified path of the directory to list the content of.
searchPatternA pattern each directory content must match to be included inside the enumeration object. E.g. "*.cpp".
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.
Returns
A pointer to a valid enumeration object or an empty enumerator object in case the directory does not exists.

◆ TryGetFileEnumerator() [1/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::TryGetFileEnumerator ( const String path,
bool  recursive = false 
)
inlinestatic

Like Arp::System::Commons::Io::Directory::GetFileEnumerator but will not throw any exception.

Parameters
pathThe fully qualified path of the directory to list the content of.
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.
Returns
A pointer to a valid enumeration object or an empty enumerator object in case the directory does not exists.

◆ TryGetFileEnumerator() [2/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::TryGetFileEnumerator ( const String path,
const char *  searchPattern,
bool  recursive = false 
)
inlinestatic

Like Arp::System::Commons::Io::Directory::GetFileEnumerator but will not throw any exception.

Parameters
pathThe fully qualified path of the directory to list the content of.
searchPatternA pattern each directory content must match to be included inside the enumeration object. E.g. "*.cpp".
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.
Returns
A pointer to a valid enumeration object or an empty enumerator object in case the directory does not exists.

The documentation for this class was generated from the following file: