FileEntry[] getFiles(
string dir,
Flag!"hidden" hidden = Yes.hidden,
Flag!"recursively" recursively = No.recursively,
Flag!"absPath" saveAbsolutePath = Yes.absPath,
Flag!"enableFilter" enableFilter = No.enableFilter,
FileType[] includedTypes = []
)
Reads entries of the directory.
Parameters
dir | Directory for listing files. |
hidden | Whether to include hidden files. Yes, by default. |
recursively | Whether to search in subdirectories. No, by default. |
saveAbsolutePath | Whether to store an absolute path or not. If Yes, a relative path of dir is converted to absolute. The parameter has no effect if dir is an absolute path. Has value Yes, by default. |
enableFilter | Whether to filter by type. No, by default. |
includedTypes | Types for including to final result. Used in conjunction with the previous parameter. |
See Also:
FileEntry[] getRegularFiles(
string dir,
Flag!"hidden" hidden = Yes.hidden,
Flag!"recursively" recursively = No.recursively,
Flag!"absPath" saveAbsolutePath = Yes.absPath
)
Gets regular files from the directory.
Parameters
dir | Directory for listing regular files. |
hidden | Whether to include hidden files. Yes, by default. |
recursively | Whether to search in subdirectories. No, by default. |
saveAbsolutePath | Whether to write the full path. Yes, by default. |
FileEntry[] getDirectories(
string dir,
Flag!"hidden" hidden = Yes.hidden,
Flag!"recursively" recursively = No.recursively,
Flag!"absPath" saveAbsolutePath = Yes.absPath
)
Gets directories from the directory.
Parameters
dir | Directory for listing directories. |
hidden | Whether to include hidden files. Yes, by default. |
recursively | Whether to search in subdirectories. No, by default. |
saveAbsolutePath | Whether to write the full path. Yes, by default. |
FileEntry[] getSymlinks(
string dir,
Flag!"hidden" hidden = Yes.hidden,
Flag!"recursively" recursively = No.recursively,
Flag!"absPath" saveAbsolutePath = Yes.absPath
)
Gets symlinks from the directory.
Parameters
dir | Directory for listing symlinks. |
hidden | Whether to include hidden files. Yes, by default. |
recursively | Whether to search in subdirectories. No, by default. |
saveAbsolutePath | Whether to write the full path. Yes, by default. |
string readLinkRecurse(string link)
Returns read symlink path. If the symlink points to other symlink, the function returns path of the last symlink of the link chain.
bool isBrokenSymlink(string link, Flag!"recurse" recurse = No.recurse)
Checks if a file is a broken symbolic link is broken (whether indicates a non-existent location).
Parameters
link | Path to link. |
recurse | Whether to check all nested symbolic links in a chain. |
bool isSymlinkToDir(in string path)
Checks if the file is a symbolic link to a directory. The check is recursive (if the link points to a link).
Parameters
path | path fo file |
Returns
whether a symbolic link is a link to a directory.
string getAbsolutePath(string path)
Returns absolute path for any raw path. Trailing slashes are removed.
void cp(
string from,
string to,
Flag!"followLinks" followLinks = No.followLinks,
Flag!"passErrors" passErrors = No.passErrors,
Flag!"printErrors" printErrors = Yes.printErrors
)
Function for copying files and directories.
Parameters
from | source file |
to | destination |
followLinks | whether to follow symbolic links |
passErrors | if No, the 'cp' function can throw exceptions else errors are ignored |
printErrors | print information about errors or not (the parameter works if passErrors is Yes) |
auto STATX_TYPE
See
man statx
auto STATX_DEFAULT
Mask for stat field by default.
FileType getFileTypeFromFileMask(uint mask) nothrow
Gets FileType by the file mask obtained from stat field 'mode'.
string makeUnixFileModeLine(in uint mode)
The function returns file permissions in a string form (like -rwxrwxrwx)
string makeUnixFileModeLine(in FileStat st)
The function returns file permissions in a string form (like -rwxrwxrwx)
void applyFileAdvise(File f, FileAdvice advice)
Predeclare an access pattern for file data.
Parameters
f | File object. |
advice | Access patern. |
See Also:
man 2 posix_fadvise
Public imports
- std.typecons
- amalthea.libcore
Enums
FileType | |
FileAdvice |
Variables
STATX_TYPE | |
STATX_DEFAULT |
Functions
Structs
DirReader | |
FileEntry | |
statx_t | |
FileStat |
Classes
DesktopEntry | |
xattr |