    

 ## On this page

  

 

 # File system

 Last update: 16.07.2025 

A collection of file system utility functions. [More...](#details)

## <a name="func-members"></a>Functions

string [canonical](group__file.xhtml#ga8b98a72819aaee1485524b72e2db4eab) (string url="") Tries to convert url, which must exist, to an absolute path that has no symbolic link, dot, or dot-dot elements. [More...](#ga8b98a72819aaee1485524b72e2db4eab)  
  [copyFile](group__file.xhtml#ga43c0665d078ffe1df1fa55dfe5dbb8d8) (string source\_url, string target\_url) copies the specified file [More...](#ga43c0665d078ffe1df1fa55dfe5dbb8d8)  
  [createDirectories](group__file.xhtml#ga15e71a3757e5c445d1853374525bff30) (string url) creates the directory and also subdirectories if required [More...](#ga15e71a3757e5c445d1853374525bff30)  
 bool [exists](group__file.xhtml#ga10d9c7723a9e8f1c4c854ac8618c4b65) (string url) bool [isDirectory](group__file.xhtml#ga9cee08428812e33a6b9fbf6bcb93fabf) (string url) bool [isRegularFile](group__file.xhtml#ga2056a4fca10b1c0adb916146ad1a51a2) (string url) boost::filesystem::path [relative](group__file.xhtml#ga7b396b4263cb6f8d00dd5b0c02dba6c5) (boost::filesystem::path from, boost::filesystem::path to) Get the relative path between two paths. [More...](#ga7b396b4263cb6f8d00dd5b0c02dba6c5)  
  [removeAll](group__file.xhtml#ga0f399219011ea9c84280b4b1f95c58d2) (string url) removes the given path and its contents [More...](#ga0f399219011ea9c84280b4b1f95c58d2)  
 <a id="details" name="details"></a>## Detailed Description

A collection of file system utility functions.

## Function Documentation

<a id="ga8b98a72819aaee1485524b72e2db4eab"></a>## [◆ ](#ga8b98a72819aaee1485524b72e2db4eab)canonical()

 string canonical  ( string  *url* = `""`) 

Tries to convert url, which must exist, to an absolute path that has no symbolic link, dot, or dot-dot elements.

Parameters urlA string defining the path. This url might be given as absolute or relative path. A relative path starts from the current working directory. For an empty string the current working directory will be assumed Returns- On sucess, an absolute path that has no symbolic link, dot, or dot-dot-elements- If a link, dot or dot-dot resolution lookup failed for some reason, e.g. the url is given in a UNC/URI definition only the absolute path will be returned

Exceptions -If the url simply not exists NoteThis is simply an exception safer wrapper of boost::filesystem::canoncial 



<a id="ga43c0665d078ffe1df1fa55dfe5dbb8d8"></a>## [◆ ](#ga43c0665d078ffe1df1fa55dfe5dbb8d8)copyFile()

 copyFile  ( string  *source\_url*,    string  *target\_url*   ) 

copies the specified file

Parameters source\_urla string defining the path of the source file target\_urla string defining the path of the target file 



<a id="ga15e71a3757e5c445d1853374525bff30"></a>## [◆ ](#ga15e71a3757e5c445d1853374525bff30)createDirectories()

 createDirectories  ( string  *url*) 

creates the directory and also subdirectories if required

Parameters urla string defining the path to be created 



<a id="ga10d9c7723a9e8f1c4c854ac8618c4b65"></a>## [◆ ](#ga10d9c7723a9e8f1c4c854ac8618c4b65)exists()

 bool exists  ( string  *url*) 

Returnstrue if the given url exists Parameters urla string defining the path to test 



<a id="ga9cee08428812e33a6b9fbf6bcb93fabf"></a>## [◆ ](#ga9cee08428812e33a6b9fbf6bcb93fabf)isDirectory()

 bool isDirectory  ( string  *url*) 

Returnstrue if the given url is a directory Parameters urla string defining the path to test 



<a id="ga2056a4fca10b1c0adb916146ad1a51a2"></a>## [◆ ](#ga2056a4fca10b1c0adb916146ad1a51a2)isRegularFile()

 bool isRegularFile  ( string  *url*) 

Returnstrue if the given url is a file Parameters urla string defining the path to test 



<a id="ga7b396b4263cb6f8d00dd5b0c02dba6c5"></a>## [◆ ](#ga7b396b4263cb6f8d00dd5b0c02dba6c5)relative()

 boost::filesystem::path relative  ( boost::filesystem::path  *from*,    boost::filesystem::path  *to*   ) 

Get the relative path between two paths.

NoteWorks for URLs that are not existing on disk, too. Parameters fromThe origin path toThe target path ReturnsA path object of the relative path. 



<a id="ga0f399219011ea9c84280b4b1f95c58d2"></a>## [◆ ](#ga0f399219011ea9c84280b4b1f95c58d2)removeAll()

 removeAll  ( string  *url*) 

removes the given path and its contents

Parameters urla string defining the path to be deleted