Skip to content

Instantly share code, notes, and snippets.

@glad1couldkek
Created October 10, 2016 11:01
Show Gist options
  • Select an option

  • Save glad1couldkek/b88ce1f7321912416c4fbab5b9c405e6 to your computer and use it in GitHub Desktop.

Select an option

Save glad1couldkek/b88ce1f7321912416c4fbab5b9c405e6 to your computer and use it in GitHub Desktop.
import time
import os
dirdl = '/home/Anon/Downloads/'
dirp = '/home/Anon/Pictures/'
dirv = '/home/Anon/Videos/'
dird = '/home/Anon/Documents/'
dirm = '/home/Anon/Music/'
dirs = [dirp, dirv, dird, dirdl, dirm]
while True:
time.sleep(10)
for u in dirs:
os.chdir(u)
items = os.listdir(u)
for i in items:
if i.endswith('jpg') or i.endswith('png'):
os.rename(u + i, dirp + i)
elif i.endswith('webm') or i.endswith('mp4'):
os.rename(u + i, dirv + i)
elif i.endswith('mp3'):
os.rename(u + i, dirm + i)
elif i.endswith('pdf') or i.endswith('epub'):
os.rename(u + i, dird + i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment