Helper functions for IO operations.
   
    
    
    
    
   
        
    
    
    
    
    
    
    
    
    
    
    
    
    
    
scan_files(folder, file_extensions=None)
Scan the folder for files and filter files by file extension.
If the optional file_extension is not set, .jpg as file extension is used by default.
folder: the folder to scan for files
file_extensions: the allowed file extensions
return: the file path list
 
 
 
 
 
    
    
    
    
    
    
scan_path(path)
Scan a folder and sub-folders until the file level.
path: the current directory to parse for folders
return: a list of folders prefixed with base directory
 
 
 
 
 
    
    
    
    
    
    
delete_folder(path)
Deletes a Folder, if exist.
path: the folder path including the folder name
return: the created folder path
 
 
 
 
 
    
    
    
    
    
    
create_folder(path, clear=False)
Creates a Folder, if not exist.
path: the folder path including the folder name
clear: whether or not the created folder should be empty
return: the created folder path
 
 
 
 
 
    
    
    
    
    
    
get_file_sha(file_path)
Calculates the SHA1 of a given file.
file_path: the file path
return: the calculated SHA1 as hex
 
 
 
 
 
    
    
    
    
    
    
assign_filename_suffix(file_path, suffix=None)
Assign a filename suffix to a given filepath. (e.g /filename.txt)
file_path: the file path to suffix
suffix: the suffix
return: the suffixed file path
 
 
 
 
 
    
    
    
    
    
    
strip_path(file_path, strip='/')
Strip trailing separators from a path
file_path: the file path to strip
return: the striped file path