Advanced Multi-Physics (AMP)
On-Line Documentation
FileSystem.h
Go to the documentation of this file.
1// This file contains helper functions and interfaces for filesystem access
2#ifndef included_AMP_FileSystem
3#define included_AMP_FileSystem
4
5
6#include <filesystem>
7#include <string>
8#include <string_view>
9
10
11namespace AMP::IO {
12
13
14/*
15 * Create the directory specified by the path string.
16 */
17void recursiveMkdir( const std::string &path );
18
19
21std::string path( const std::string &filename );
22
23
25std::string filename( const std::string &filename );
26
27
29void permissions( const std::string &filename, std::filesystem::perms mode );
30
31
33bool exists( const std::string &filename );
34
35
37size_t fileSize( const std::string &filename );
38
39
41void rename( const std::string &old_filename, const std::string &new_filename );
42
43
45void deleteFile( const std::string &filename );
46
47
49std::string getSuffix( const std::string &filename );
50
51
52// Deprecated functions
53#if !( defined( WIN32 ) || defined( _WIN32 ) || defined( WIN64 ) || defined( _WIN64 ) || \
54 defined( _MSC_VER ) )
55[[deprecated( "recursiveMkdir(path,mode,rank_create) is deprecated, no need to specify "
56 "only_node_zero_creates, use recursiveMkdir(path)" )]] void
57recursiveMkdir( const std::string &, mode_t, bool );
58[[deprecated( "recursiveMkdir(path,mode) is deprecated, use recursiveMkdir(path) and "
59 "permissions(mode)" )]] void
60recursiveMkdir( const std::string &, mode_t );
61#endif
62[[deprecated( "fileExists() is deprecated, use exists()" )]] bool fileExists( const std::string & );
63[[deprecated( "renameFile() is deprecated, use rename()" )]] void
64renameFile( const std::string &old_filename, const std::string &new_filename );
65
66
67} // namespace AMP::IO
68
69#endif
bool fileExists(const std::string &)
std::string filename(const std::string &filename)
Return the filename (strip the path)
std::string path(const std::string &filename)
Return the path to the file.
void renameFile(const std::string &old_filename, const std::string &new_filename)
size_t fileSize(const std::string &filename)
Return the file size.
bool exists(const std::string &filename)
Check if a file exists and return true if it does.
void permissions(const std::string &filename, std::filesystem::perms mode)
Set the permissions for the file or directory.
void recursiveMkdir(const std::string &path)
void rename(const std::string &old_filename, const std::string &new_filename)
Rename a file from old file name to new file name.
void deleteFile(const std::string &filename)
Delete a file. If the file does not exist, nothing will happen.
std::string getSuffix(const std::string &filename)
Get the lower case suffix for a file.



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:40.
Comments on this page