{{ header }}

util_pathio#

path#

path2linux(path)

Convert path to linux path for all OSes.

path2uniform(path)

Convert path to a uniform path for all OSes This function is an alternative function of path2linus.

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

Get a list of filenames in a folder by file extension.

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

Get a list of filenames in a folder by file extension.

check_files_in_dir(filenames[, dir_path, ...])

Check if provided list of files exist in the given directory.

check_filename(filename)

Validate the filename, if the file exists, return True, otherwise False.

check_file_existence(filename)

Validate the filename, if the file exists, return True, otherwise False.

generate_unique_filename(filename[, suffix_num])

Generate a unique filename by adding a suffix number to the end of the filename.

create_unique_filename(filename[, suffix_num])

Generate a unique filename by adding a suffix number to the end of the filename.

show_dir_in_tree(dir_name[, pattern, ...])

List contents of directories in a tree-like format.

add_pkg_to_sys_path(pkg_name[, verbose])

Automatically finds an importable Python package by its name in the current directory, parent directories, or child directories, and adds it to the system path.

find_executable_from_PATH_on_win(exe_name[, ...])

Find the executable from the system PATH.

find_fname_from_PATH_on_win(fname[, ext, ...])

Find the filename from the system PATH.

io#

get_file_size(filename[, unit])

Get the size of a file in the specified unit.

size_of_file(fname[, unit])

Get the size of a file in the specified unit.

get_dir_size(directory[, unit])

Get the size of a directory in the specified unit.

size_of_dir(directory[, unit])

Get the size of a directory in the specified unit.

create_tempfile([base_dir, ext])

Create a temporary file with the specified size.

file_remove(filename)

Remove a file from the filesystem.

file_delete(filename)

Remove a file from the filesystem.

add_dir_to_env([path_dir])

Add a directory to the PATH environment variable.

pickle_save(obj, filename[, base_dir])

Save an object to a file using the pickle module.

pickle_load(filename)

Load an object from a file using the pickle module.

find_duplicate_files(root_folder)

Find duplicate files in a directory and its subdirectories.

remove_duplicate_files(root_folder)

Remove duplicate files in a directory and its subdirectories.

platform#

check_platform()

Check the current platform.

is_windows()

Check if the current platform is Windows.

is_linux()

Check if the current platform is Linux.

is_mac()

Check if the current platform is Mac/OSX.

terminal_width()

Get the terminal width.

terminal_height()

Get the terminal height.

argparse#

with_argparse(func_or_class)

Decorator to add argparse support to a function or class.