devctrl.utility.file_io#

Functions

add_zeros

return v as string, add leading zeros if len(str(v)) < digits

get_date_for_filename

get_date_time_for_filename

get_next_filename

If the filepath does not exists, returns the filepath.

get_next_filename_with_number

get the next filename (without extenstion). example: basename = file directory has file001.csv, file002.bla.pkl, file004.csv -> return file005.

listdir_abs

Version of os.listdir that returns absolute paths and is sorted by name :param base_dir: :return:

listdir_filter

Return absolute paths of directories in base_dir that match the filter_regex

sanitize_filename

Remove invalid characters from filename. Do not use in on paths, but only on the file name! :param filename: :return: filename with /*?:"<>|.

search_in_path

Search for a file or directory called <name> in the current working directory and sys.path :param name: Name of the file :return: Absolute path including filename :raise: FileNotFoundError if file is not found