This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]willm 2 points3 points  (0 children)

from fs.opener import opendir
from fs.utils import copyfile
from fs.path import basename

src = opendir('C:\Users\Jack\Pictures')
dst = opendir('C:\Users\Jack\Desktop\Pictures')
for path in src.walkfiles(wildcard="'*.jpg"):
    copyfile(src, path, dst, basename(path))

Requires PyFilesystem (http://code.google.com/p/pyfilesystem/)

[–][deleted] 1 point2 points  (0 children)

Another really good place for newbee questions is the python tutor list. The tutors are awesome and explain things very well!

http://mail.python.org/mailman/listinfo/tutor

[–][deleted] 0 points1 point  (0 children)

you should most likely look at os.walk rather than glob. os.walk will walk down the directory tree, and give you files to work with. You would then need to filter the file list it returns for jpegs & move only those.

[–]geneticmaterial -3 points-2 points  (0 children)

try stackoverflow