Created
May 11, 2013 07:09
-
-
Save shibukawa/5559165 to your computer and use it in GitHub Desktop.
Copy pictures and merged into Picasa folder from Dropbox camera upload folder
This file contains hidden or 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, time, shutil | |
distroot = r"c:\Users\shibu\newPictures" | |
created_dirs = set() | |
for dirpath, dirnames, filenames in os.walk(r"C:\Users\shibu\Dropbox\Camera Uploads"): | |
print(dirpath) | |
for filename in filenames: | |
fullpath = os.path.join(dirpath, filename) | |
dirname = filename[0:10] | |
if os.path.splitext(filename)[1] != '.jpg': | |
continue | |
print(filename + ' -> ' + dirname) | |
distdir = os.path.join(distroot, dirname) | |
if distdir not in created_dirs and not os.path.exists(distdir): | |
os.makedirs(distdir) | |
created_dirs.add(distdir) | |
print(" %s created" % dirname) | |
distpath = os.path.join(distdir, filename) | |
shutil.copy2(fullpath, distpath) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment