dirs

Utilities for directory and file operations, navigation and management.

Path formatting

normalize_path(path[, sep, as_str, prepend_dot])

Convert a path into a consistent format for cross-platform compatibility.

standardize_path(path[, sep, parents])

Standardize file and directory paths.

get_relative_path(path[, as_str, ...])

Check if the pathname is relative to the current working directory.

format_display_path(path[, normalized, ...])

Format a path string for display, logging or printing purposes.

Path validation

is_dir_path(dir_path)

Check whether a string is formatted as a directory path.

validate_filename(file_path[, suffix_num])

Validate a filename, generating a uniquely suffixed name if the file already exists.

check_files_exist(filenames, dir_path[, verbose])

Check whether specified files exist within a given directory.

Directory navigation

cd(*subdir[, mkdir, cwd, back_check, ...])

Specify and resolve the pathname of a directory or file.

cdd(*subdir[, mkdir, data_dir])

Specify and resolve the pathname of a directory (or file) under the designated data_dir.

cd_data(*subdir[, data_dir, mkdir, as_str])

Specify and resolve the pathname of a directory (or file) under data_dir of a package.

resolve_dir_path([dir_path, subdir, msg])

Resolve a directory path into an absolute pathname.

find_executable(name[, options, target, ...])

Find the pathname of an executable file for a specified application.

Directory management

delete_dir(dir_path[, ...])

Delete a directory or multiple directories.

get_file_paths(dir_path[, file_ext, ...])

Get the paths of files in a directory, optionally filtered by file extension.