Filesystem
Last updated
Last updated
Cement includes a with helpers for common tasks related to filesystem management.
API References:
Creating and cleaning up temporary directories and files can be tedious, so we created the class to make management easy:
Best practice when working with paths is to use os.path.join()
to ensure cross-platform compatibility and also expanding the absolute path to account for things like ~
(user home dir) on Linux. We've created a number of helpers to meld these together for common tasks:
Creating a .bak
of a directory or file before modifying it is one of the most common tasks when working with the filesystem, but often takes some tedious code to do so without overwriting existing backups. The creates a .bak
file, or if it exists .bak.0
, .bak.1
, .bak.2
, etc.