Module zut.files

File and directory operations, compatible with both the local file system and Samba/Windows shares.

Functions

archivate(path[, archive_dir, missing_ok, keep])

Archivate path to archive_dir directory, ensuring unique archive name.

basename(path)

can_use_network_paths()

copy(src, dst[, follow_symlinks])

Copy file data and file data and file's permission mode (which on Windows is only the read-only flag).

copy2(src, dst[, follow_symlinks])

Identical to copy() except that copy2() also attempts to preserve the file metadata.

copyfile(src, dst[, follow_symlinks])

Copy the contents (no metadata) in the most efficient way possible.

copymode(src, dst[, follow_symlinks])

Copy the permission bits from src to dst.

copystat(src, dst[, follow_symlinks])

Copy the read-only attribute, last access time, and last modification time from src to dst.

copytree(src, dst[, symlinks, ignore, ...])

Recursively copy a directory tree rooted at src to a directory named dst and return the destination directory.

dirname(path)

exists(path)

indir(path[, dir])

Return the given path from within the given directory if any, relative to the current directory.

join(*paths)

makedirs(path[, exist_ok])

mtime(path)

open(path[, mode, buffering, encoding, ...])

read_bytes(path)

Open the file in bytes mode, read it, and close the file.

read_text(path[, encoding, errors])

Open the file in text mode, read it, and close the file.

remove(path[, missing_ok])

rmtree(path[, ignore_errors, onerror, ...])

splitext(path)

stat(path)

write_bytes(path, data)

Open the file in bytes mode, write to it, and close the file.

write_text(path, data[, encoding, errors, ...])

Open the file in text mode, write to it, and close the file.