Tools for paths and files


add_to_zip(zip_path, dirs_to_add)

Add folders to an already existing zip file (recursively).

archive(folder_path, archive_path[, fmt])

Archives a folder recursively.

copy(src, dst)

Copy a file or a directory (recursively) with copytree or copy2.

extract_file(file_path, output[, overwrite])

Extract an archived file (zip or others).

extract_files(archives, output[, overwrite])

Extract all archived files.

find_files(names, root_paths[, ...])

Returns matching files recursively from a list of root paths.


Get the list of all the files contained in an archive.

get_archived_path(archive_path, file_regex)

Get archived file path from inside the archive.

get_archived_rio_path(archive_path, file_regex)

Get archived file path from inside the archive, to be read with rasterio:


Get file extension from file path, ie: WITHOUT THE FIRST POINT

get_file_in_dir(directory, pattern_str[, ...])

Get one or all matching files (pattern + extension) from inside a directory.

get_filename(file_path[, other_exts])

Get file name (without extension) from file path, ie:


Get the root path of the current disk:

hash_file_content(file_content[, len_param])

Hash a file into a unique str.


Determine whether the directory is writeable or not.


Get absolute path of all files in the given directory.


Load a pickled object.

read_archived_file(archive_path, regex)

Read archived file (in bytes) from zip or tar archives.

read_archived_html(archive_path, regex)

Read archived HTML from zip or tar archives.

read_archived_xml(archive_path, xml_regex)

Read archived XML from zip or tar archives.

read_json(json_file[, print_file])

Read a JSON file

real_rel_path(raw_path, start)

Gives the real relative path from a starting folder.


Deletes a file or a directory (recursively) using shutil.rmtree or os.remove.

remove_by_pattern(directory[, ...])

Remove files corresponding to a pattern from a directory.

save_json(json_dict, output_json, **kwargs)

Save a JSON file, with datetime, numpy types and Enum management.

save_obj(obj, path, **kwargs)

Save an object as a pickle (can save any Python objects).

to_abspath(raw_path[, create, ...])

Return the absolute path of the specified path and check if it exists


CustomDecoder(*args, **kwargs)

Decoder for JSON with methods for datetimes

CustomEncoder(*[, skipkeys, ensure_ascii, ...])

Encoder for JSON with methods for datetimes and np.int64