Module zut.files

A standardized interface to access different kinds of “files”: entries in ZIP archives, samba shares, S3 objects, access via sudo.

Functions

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

Archivate path to archive_dir directory (or zip entry), ensuring unique archive name.

basename(path)

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)

get_adapter(path)

get_modified_at(path)

is_smb_configured(path)

isabs(path)

isdir(path)

join(base, *names[, sep, expanduser, mkparent])

A path join function that do not depend on the platform, is compatible with URLs, SMB shares and zipPath directory entries.

makedirs(path, *[, exist_ok])

open()

read_bytes(path, *[, mkdir, sudo])

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, tree_ok])

set_modified_at(path, value)

split(path)

A path split function that do not depend on the platform, is compatible with URLs, SMB shares and zipPath directory entries: - Keep leading slash(es): may be Linux root or SMB share - Keep trailing slash(es): may indicate a directory (necessary in ZipPath.at to designate a directory) - Keep URL separator ://

stat(path)

write_bytes(path, data, *[, mkdir, sudo])

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

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

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

Classes

BaseAdapter()

BaseOpenTempContext(path[, mode, buffering, ...])

BaseStat(path)

FileAdapter()

FileStat(path)