Last active
August 29, 2015 14:04
-
-
Save montycheese/defccf97d055674dfce9 to your computer and use it in GitHub Desktop.
Delete files with multiple versions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, glob | |
path = "/Users/mowong/Documents/Thumbnails/Big_Thumbnail_Project" # update to current dir | |
list = ["1","3","4"] #append here the version number(s) | |
for x in list: | |
for files in glob.glob("/Users/mowong/Documents/Thumbnails/Big_Thumbnail_Project/*-0%s.jpg" % x): | |
os.remove(files) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, glob, shutil | |
# src1 = "/Users/mowong/Documents/Thumbnails/Big_Thumbnail_Project" | |
dst = "/Users/mowong/Desktop/Trashed_thumbs" | |
list = ["01", "03", "04", "06", "07", "08","09", "10", "11", "12", "13"] | |
for x in list: | |
for files in glob.glob("/Users/mowong/Documents/Thumbnails/JJsprojectThumbs/*-%s.jpg" % x): | |
shutil.move(files, dst ) #moves extras to new dir. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, glob, shutil | |
dst = "/Users/mowong/Desktop/Trashed_thumbs" | |
list = ["16","17","18","19","20","21","22", | |
"23","24","25", "26","27","28","29", | |
"30","31","32","33","34","35","36","37", | |
"38","39","40" | |
] | |
for x in list: | |
for files in glob.glob("/Users/mowong/Documents/Thumbs_exported/400x300/samjack/mas/*_0%s.jpg" % x): | |
os.mkdir("/Users/mowong/Documents/Thumbs_exported/400x300/samjack/mas/0%s" % x) | |
shutil.move(files, "/Users/mowong/Documents/Thumbs_exported/400x300/samjack/mas/0%s" % x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment