Skip to content

Latest commit

History

History
57 lines (37 loc) 路 1.59 KB

fileutils.rst

File metadata and controls

57 lines (37 loc) 路 1.59 KB

fileutils - Filesystem helpers

boltons.fileutils

Creating, Finding, and Copying

Python's os, os.path, and shutil modules provide good coverage of file wrangling fundamentals, and these functions help close a few remaining gaps.

boltons.fileutils.mkdir_p

boltons.fileutils.iter_find_files

boltons.fileutils.copytree

Atomic File Saving

Ideally, the road to success should never put current progress at risk. And that's exactly why atomic_save and AtomicSaver exist.

Using the same API as a writable file, all output is saved to a temporary file, and when the file is closed, the old file is replaced by the new file in a single system call, portable across all major operating systems. No more partially-written or partially-overwritten files.

boltons.fileutils.atomic_save

boltons.fileutils.AtomicSaver

boltons.fileutils.atomic_rename

boltons.fileutils.replace

File Permissions

Linux, BSD, Mac OS, and other Unix-like operating systems all share a simple, foundational file permission structure that is commonly complicit in accidental access denial, as well as file leakage. FilePerms was built to increase clarity and cut down on permission-related accidents when working with files from Python code.

boltons.fileutils.FilePerms

Miscellaneous

boltons.fileutils.DummyFile