https://doc.rust-lang.org/std/fs/index.html

std::fs - Rust

Expand description

Filesystem manipulation operations.

This module contains basic methods to manipulate the contents of the local filesystem. All methods in this module represent cross-platform filesystem operations. Extra platform-specific functionality can be found in the extension traits of std::os::$platform.

DirBuilderA builder used to create directories in various manners.DirEntryEntries returned by the ReadDir iterator.FileAn object providing access to an open file on the filesystem.FileTimesRepresentation of the various timestamps on a file.FileTypeA structure representing a type of file with accessors for each file type. It is returned by Metadata::file_type method.MetadataMetadata information about a file.OpenOptionsOptions and flags which can be used to configure how a file is opened.PermissionsRepresentation of the various permissions on a file.ReadDirIterator over the entries in a directory.canonicalizeReturns the canonical, absolute form of a path with all intermediate components normalized and symbolic links resolved.copyCopies the contents of one file to another. This function will also copy the permission bits of the original file to the destination file.create_dirCreates a new, empty directory at the provided pathcreate_dir_allRecursively create a directory and all of its parent components if they are missing.existsReturns Ok(true) if the path points at an existing entity.hard_linkCreates a new hard link on the filesystem.metadataGiven a path, queries the file system to get information about a file, directory, etc.readReads the entire contents of a file into a bytes vector.read_dirReturns an iterator over the entries within a directory.read_linkReads a symbolic link, returning the file that the link points to.read_to_stringReads the entire contents of a file into a string.remove_dirRemoves an empty directory.remove_dir_allRemoves a directory at this path, after removing all its contents. Use carefullyremove\_fileRemoves a file from the filesystem.renameRenames a file or directory to a new name, replacing the original file if to already exists.set_permissionsChanges the permissions found on a file or a directory.soft_link DeprecatedCreates a new symbolic link on the filesystem.symlink_metadataQueries the metadata about a file without following symlinks.writeWrites a slice as the entire contents of a file.