Skip to content

Instantly share code, notes, and snippets.

@gitUmaru
Last active July 29, 2020 23:24
Show Gist options
  • Save gitUmaru/c303ab10101ab86eccf36a151011658b to your computer and use it in GitHub Desktop.
Save gitUmaru/c303ab10101ab86eccf36a151011658b to your computer and use it in GitHub Desktop.
Delete certain files --- This very short python script simply deletes all files with a certain extension (or some other pattern). I took photos on a bike ride and the SD card was riddled with raw files and the JPG files; I only needed the JPG so this script removes any unwanted files.
import glob
import os
filenames = glob.glob('*.ARW')
for file in filenames:
os.remove(file)
print(file + " has been deleted, moving on to next file")
print("All files have been deleted, thank you")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment