os_utils

Module for managing files and folders

sentinelhub.os_utils.get_content_list(folder='.')[source]

Get list of contents in input folder

Parameters:folder (str) – input folder to list contents. Default is '.'
Returns:list of folder contents
Return type:list(str)
sentinelhub.os_utils.get_folder_list(folder='.')[source]

Get list of sub-folders contained in input folder

Parameters:folder (str) – input folder to list sub-folders. Default is '.'
Returns:list of sub-folders
Return type:list(str)
sentinelhub.os_utils.get_file_list(folder='.')[source]

Get list of files contained in input folder

Parameters:folder (str) – input folder to list files only. Default is '.'
Returns:list of files
Return type:list(str)
sentinelhub.os_utils.create_parent_folder(filename)[source]

Create parent folder for input filename recursively

Parameters:filename (str) – input filename
Raises:error if folder cannot be created
sentinelhub.os_utils.make_folder(path)[source]

Create folder at input path recursively

Create a folder specified by input path if one does not exist already

Parameters:path (str) – input path to folder to be created
Raises:os.error if folder cannot be created
sentinelhub.os_utils.rename(old_path, new_path, edit_folders=True)[source]

Rename files or folders

Parameters:
  • old_path (str) – name of file or folder to rename
  • new_path (str) – name of new file or folder
  • edit_folders (bool) – flag to allow recursive renaming of folders. Default is True
sentinelhub.os_utils.size(pathname)[source]

Returns size of a file or folder in Bytes

Parameters:pathname (str) – path to file or folder to be sized
Returns:size of file or folder in Bytes
Return type:int
Raises:os.error if file is not accessible
sentinelhub.os_utils.sys_is_windows()[source]

Check if user is running the code on Windows machine

Returns:True if OS is Windows and False otherwise
Return type:bool