[#BloombergLP-bdls-FilesystemUtil]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdls.adoc[bdls]::FilesystemUtil
:relfileprefix: ../../
:mrdocs:

This `struct` provides a namespace for utility functions dealing with platform&hyphen;independent filesystem access&period;

== Synopsis

Declared in `&lt;bdls&lowbar;filesystemutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
struct FilesystemUtil;
----

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdls/FilesystemUtil/FileDescriptor.adoc[`FileDescriptor`] 
| `FileDescriptor` is an alias for the operating system&apos;s native file descriptor &sol; file handle type&period;
| xref:BloombergLP/bdls/FilesystemUtil/Offset.adoc[`Offset`] 
| `Offset` is an alias for a signed value, representing the offset of a location within a file&period;
|===


== Enums

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdls/FilesystemUtil/_04enum.adoc[`Unnamed enum`] 
| Default growth increment for file operations&period;
| xref:BloombergLP/bdls/FilesystemUtil/ErrorType.adoc[`ErrorType`] 
| Enumeration of error codes returned by certain filesystem operations&period;
| xref:BloombergLP/bdls/FilesystemUtil/FileIOPolicy.adoc[`FileIOPolicy`] 
| Enumeration used to distinguish between different sets of actions permitted on an open file descriptor&period;
| xref:BloombergLP/bdls/FilesystemUtil/FileOpenPolicy.adoc[`FileOpenPolicy`] 
| Enumeration used to determine whether &apos;open&apos; should open an existing file, or create a new file&period;
| xref:BloombergLP/bdls/FilesystemUtil/FileTruncatePolicy.adoc[`FileTruncatePolicy`] 
| Enumeration used to distinguish between different ways to handle the contents, if any, of an existing file immediately upon opening the file&period;
| xref:BloombergLP/bdls/FilesystemUtil/Whence.adoc[`Whence`] 
| Enumeration used to distinguish among different starting points for a seek operation&period;
|===


== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdls/FilesystemUtil/close.adoc[`close`] 
| Close the specified `descriptor`&period;
| xref:BloombergLP/bdls/FilesystemUtil/createDirectories-04.adoc[`createDirectories`] 
| Create any directories in the specified `path` that do not exist&period;
| xref:BloombergLP/bdls/FilesystemUtil/createPrivateDirectory-0e.adoc[`createPrivateDirectory`] 
| Create a private directory with the specified `path`&period;
| xref:BloombergLP/bdls/FilesystemUtil/createTemporaryDirectory-04.adoc[`createTemporaryDirectory`] 
| Create a new temporary directory with a name based on `prefix`&period;
| xref:BloombergLP/bdls/FilesystemUtil/createTemporaryFile-08.adoc[`createTemporaryFile`] 
| Create and open a new temporary file with a name based on `prefix`&period;
| xref:BloombergLP/bdls/FilesystemUtil/createTemporarySubdirectory-00.adoc[`createTemporarySubdirectory`] 
| Create a new temporary directory under `rootDirectory`&period;
| xref:BloombergLP/bdls/FilesystemUtil/exists-056.adoc[`exists`] 
| Return `true` if a file or directory currently exists at `path`&period;
| xref:BloombergLP/bdls/FilesystemUtil/findMatchingPaths-065e.adoc[`findMatchingPaths`] 
| Load into `result` all filesystem paths matching `pattern`&period;
| xref:BloombergLP/bdls/FilesystemUtil/getAvailableSpace-01.adoc[`getAvailableSpace`] 
| `getAvailableSpace` overloads
| xref:BloombergLP/bdls/FilesystemUtil/getFileSize-0d.adoc[`getFileSize`] 
| `getFileSize` overloads
| xref:BloombergLP/bdls/FilesystemUtil/getFileSizeLimit.adoc[`getFileSizeLimit`] 
| Return the file size limit for this process&period;
| xref:BloombergLP/bdls/FilesystemUtil/getLastModificationTime-09.adoc[`getLastModificationTime`] 
| `getLastModificationTime` overloads
| xref:BloombergLP/bdls/FilesystemUtil/getSymbolicLinkTarget-0fb.adoc[`getSymbolicLinkTarget`] 
| Load into `result` the target of the symbolic link at `path`&period;
| xref:BloombergLP/bdls/FilesystemUtil/getSystemTemporaryDirectory-077.adoc[`getSystemTemporaryDirectory`] 
| Load a valid path to the system temporary directory into `path`&period;
| xref:BloombergLP/bdls/FilesystemUtil/getWorkingDirectory-01.adoc[`getWorkingDirectory`] 
| Load into `path` the absolute pathname of the current working directory&period;
| xref:BloombergLP/bdls/FilesystemUtil/growFile.adoc[`growFile`] 
| Grow the file with `descriptor` to at least the specified `size`&period;
| xref:BloombergLP/bdls/FilesystemUtil/isDirectory-02.adoc[`isDirectory`] 
| `isDirectory` overloads
| xref:BloombergLP/bdls/FilesystemUtil/isRegularFile-0a.adoc[`isRegularFile`] 
| Return `true` if a regular file currently exists at `path`&period;
| xref:BloombergLP/bdls/FilesystemUtil/isSymbolicLink-09.adoc[`isSymbolicLink`] 
| Return `true` if a symbolic link currently exists at `path`&period;
| xref:BloombergLP/bdls/FilesystemUtil/lock.adoc[`lock`] 
| Acquire a lock for the file with the specified `descriptor`&period;
| xref:BloombergLP/bdls/FilesystemUtil/makeUnsafeTemporaryFilename-09.adoc[`makeUnsafeTemporaryFilename`] 
| Construct a temporary file name by appending a suffix to `prefix`&period;
| xref:BloombergLP/bdls/FilesystemUtil/map.adoc[`map`] 
| Map a region of the file with `descriptor` into memory&period;
| xref:BloombergLP/bdls/FilesystemUtil/mapChecked.adoc[`mapChecked`] 
| Map a region of the file with `descriptor`, rejecting past&hyphen;EOF maps&period;
| xref:BloombergLP/bdls/FilesystemUtil/move-0d.adoc[`move`] 
| Move the file or directory at `oldPath` to `newPath`&period;
| xref:BloombergLP/bdls/FilesystemUtil/open-0f.adoc[`open`] 
| Open the file at the specified `path` according to the given policies&period;
| xref:BloombergLP/bdls/FilesystemUtil/read.adoc[`read`] 
| Read `numBytes` from the file with `descriptor` into `buffer`&period;
| xref:BloombergLP/bdls/FilesystemUtil/remove-0e.adoc[`remove`] 
| Remove the file or directory at the specified `path`&period;
| xref:BloombergLP/bdls/FilesystemUtil/rollFileChain.adoc[`rollFileChain`] 
| Roll the file chain at `path` so that `path` becomes `path&period;1`&period;
| xref:BloombergLP/bdls/FilesystemUtil/seek.adoc[`seek`] 
| Set the file pointer associated with `descriptor` according to `whence`&period;
| xref:BloombergLP/bdls/FilesystemUtil/setWorkingDirectory-00.adoc[`setWorkingDirectory`] 
| Set the working directory of the current process to the specified `path`&period;
| xref:BloombergLP/bdls/FilesystemUtil/sync.adoc[`sync`] 
| Synchronize mapped memory at `address` with the underlying file&period;
| xref:BloombergLP/bdls/FilesystemUtil/truncateFileSize.adoc[`truncateFileSize`] 
| Set the size of the file referred to by `descriptor` to `size`&period;
| xref:BloombergLP/bdls/FilesystemUtil/tryLock.adoc[`tryLock`] 
| Acquire a lock for the file with `descriptor` if it is available&period;
| xref:BloombergLP/bdls/FilesystemUtil/unlock.adoc[`unlock`] 
| Release any lock this process holds on the file with `descriptor`&period;
| xref:BloombergLP/bdls/FilesystemUtil/unmap.adoc[`unmap`] 
| Unmap the memory mapping with the specified `address` and `size`&period;
| xref:BloombergLP/bdls/FilesystemUtil/visitPaths-0f.adoc[`visitPaths`] 
| Call `visitor` for each filesystem path matching the specified `pattern`&period;
| xref:BloombergLP/bdls/FilesystemUtil/visitTree.adoc[`visitTree`] 
| Recursively visit files under `root` whose leaf names match `pattern`&period;
| xref:BloombergLP/bdls/FilesystemUtil/write.adoc[`write`] 
| Write `numBytes` from `buffer` to the file with `descriptor`&period;
|===


== Static Data Members

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdls/FilesystemUtil/k_INVALID_FD.adoc[`k&lowbar;INVALID&lowbar;FD`] 
| `FileDescriptor` value representing no file, used as the error return for `open`&period;
| xref:BloombergLP/bdls/FilesystemUtil/k_OFFSET_MAX.adoc[`k&lowbar;OFFSET&lowbar;MAX`] 
| maximum representable file offset value
| xref:BloombergLP/bdls/FilesystemUtil/k_OFFSET_MIN.adoc[`k&lowbar;OFFSET&lowbar;MIN`] 
| minimum representable file offset value
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
