import os def delete_small_files(directory): for filename in os.listdir(directory): filepath = os.path.join(directory, filename) try: # Get the size of the file file_size = os.stat(filepath).st_size # Check if the file size is smaller than 90000 bytes if file_size < 90000: # Delete the file os.remove(filepath) print(f"Deleted file: {filepath}") except OSError as e: print(f"Error deleting {filepath}: {e}") # Specify the directory containing the files directory = '/webdata/web/www/htdocs/data/geo/images/suvi-goes-16/animation_images' # Call the function to delete small files delete_small_files(directory)