Skip to content

Instantly share code, notes, and snippets.

@spinningD20
Created November 14, 2016 03:08
Show Gist options
  • Save spinningD20/cd7cf5259e25466a86fa6ce64f029c61 to your computer and use it in GitHub Desktop.
Save spinningD20/cd7cf5259e25466a86fa6ce64f029c61 to your computer and use it in GitHub Desktop.
needed something quick to go through a media collection, search on youtube if I didn't know what it was, and give the option to skip the file or delete it.
import fnmatch
import os, sys
#import pyperclip # for clipboard usage
import webbrowser
for file in os.listdir('.'):
if fnmatch.fnmatch(file, '*'+sys.argv[1]+'*'):
print "File: " + file
choice = raw_input("Delete? Y/N/L")
if choice.upper() == 'L':
webbrowser.open_new_tab('https://www.youtube.com/results?search_query='+file)
choice = raw_input("Delete? Y/N")
if choice.upper() == 'Y':
os.remove(file)
print('deleted')
else:
print('skipped')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment