Skip to content

Instantly share code, notes, and snippets.

@inceax
Created April 16, 2015 06:35
Show Gist options
  • Save inceax/cd6784f21043f7e92c07 to your computer and use it in GitHub Desktop.
Save inceax/cd6784f21043f7e92c07 to your computer and use it in GitHub Desktop.
flickr_upload all directories
#!/usr/bin/python
import os
import subprocess
# Flickr Uploader using Directory Name as Title
# Based on...
# http://ubuntuforums.org/showthread.php?t=1416977
# http://search.cpan.org/~cpb/Flickr-Upload/flickr_upload
alldirnames = []
for dirname, dirnames, filenames in os.walk('.', topdown=False):
alldirnames.append(dirname)
alldirnames.sort()
for dirname in alldirnames:
name = os.path.basename(dirname)
if name == '.':
continue
d = dirname.replace(' ', '\ ')
cmd = 'flickr_upload --title "' + name + '" ' + d + '/*'
print cmd
os.system(cmd)
# try:
# subprocess.call([cmd])
# except OSError:
# print "cmd failed"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment