View Full Version : Image collecting question
jdbnsn
02-25-2011, 01:13 PM
Does anyone know a good way to collect photos from many subdirectories and pool them all into a single folder? I saw something about picaso but maybe someone here knows a better way. I have a folder with hundreds of folders within and each sub folder has images that I want to collect into one folder without opening and dragging each one at a time.
OvRiDe
02-25-2011, 03:03 PM
Probably your easiest bet is Windows Search. Go to the root of the top level folder that contains all the images/subdirs of image and search for "*.jpg". Once the Search is complete, use a "Ctrl+A" so select all the results, then "Ctrl+X" to cut those results. Go create your new folder, and "Ctrl+V" to paste it. If you have more then one image type ie. png, gif, etc etc... then just repeat the process for those file types. Voila! You should be left with a single dir with all your pics.
xr4man
02-25-2011, 03:10 PM
that's what i was going to suggest too, but i didn't know the shortcut key for "cut".
jdbnsn
02-25-2011, 04:06 PM
Dude, you are like the Yoda of PC knowledge! Thanks Curtis.
Airbozo
02-25-2011, 04:07 PM
Jon, you calling Curtis short and ugly?
crenn
02-25-2011, 04:34 PM
Jon, you calling Curtis short and ugly?
Hey, don't make Yoda mad!
#!python
import os
import sys
import shutil
srcdir = sys.argv[1]
destdir = sys.argv[2]
extensions = ['jpg','jpeg','png','gif','bmp']
def copyfile(source, dest):
if(os.path.exists(source)):
shutil.copy(source,dest)
def cleanpath(path):
if(path[-1] != "\\"):
path = path + "\\"
return path
def treecopy(dir):
dir = dir.strip()
dir = cleanpath(dir)
srcdir = cleanpath(srcdir)
contents = os.listdir(dir)
max = len(contents)
pos = 0
while(pos < max):
entry = contents[pos]
if(os.path.isfile(dir + entry)):
for ext in extensions:
if(entry[entry.rindex(".")+1:].lower().find(x.lower()) > -1):
source = srcdir + entry
copyfile(source,destdir)
elif(os.path.isdir(dir + entry)):
subdir = os.listdir(dir + entry)
for each in subdir:
each = entry + "\\" + each
contents.append(each)
max += 1
pos += 1
treecopy(destdir)
:whistler:
EDIT:
Actually, that would have just copied all the files. Fixed to only copy specified extensions.
EDIT2:
BTW, if using on a unix-like system, replace the "\\" characters with "/".
jdbnsn
02-26-2011, 01:04 AM
Jon, you calling Curtis short and ugly?
no no no not at all, you misunderstood my intentions. I just meant that he a very in-depth knowledge of the computer force, a way with words, ...and a very trademark managerial style...
http://media.ebaumsworld.com/picture/Jagnhoff/yoda.png
Oneslowz28
02-26-2011, 06:24 PM
Jon, you calling Curtis short and ugly?
Well Curtis is short and ugly.
I do think it was wrong to insult him like that though.....
Yoda I mean.
OvRiDe
02-26-2011, 06:25 PM
You guys better not be calling me green.:evil:
Oneslowz28
02-26-2011, 08:35 PM
You're Green!
Powered by vBulletin® Version 4.2.1 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.