Skip to content
A small command-line python script that creates a local backup of your Flickr data. It mirrors images, titles, description, tags, albums and collections.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
tox.ini Set file timestamps on downloaded photos Feb 16, 2016


A small command-line python script that creates a local backup of your Flickr data. It mirrors images, videos, titles, description, tags, albums and collections.

Available at


  • python 2.something
  • python dateutil
    • Ubuntu: apt-get install python-dateutil
  • python flickrapi library 2.0 or newer.
  • python requests


The script was developed on Linux. It should work on other Unixy operating systems such as OS X, hopefully without changes. It could probably be made to work on Microsoft Windows with minor changes.

e.x. ./ /mnt/backup/flickr/

Running via Cron

Running this script regularly via cron is a good way to keep your backup up to date. For example, create the file /etc/cron.d/flickr_backup containing the following:

# Run Flickr photo mirroring script.
# Sleep between 0 and 4 hours to distribute load on Flickr's API servers.
0 3 * * 2  root  sleep $((`bash -c 'echo $RANDOM'` \% 14400)) && /usr/local/bin/ -q /mnt/backup/flickr/

If you run the cronjob as a user other than yourself you may need to take additional steps to make sure the cron user is able to authenticate. The steps are something like this:

  1. Run the script as yourself the first time around. It should pop open your web browser and request permission.
  2. After granting permission an authorization token is stored in ~/.flickr/9c5c431017e712bde232a2f142703bb2/auth.token
  3. Copy this file to the home directory of the cron user:
    sudo mkdir -p /root/.flickr/9c5c431017e712bde232a2f142703bb2/
    sudo cp ~/.flickr/9c5c431017e712bde232a2f142703bb2/auth.token \


The script creates this directory hierarchy:

dest_dir/Not in any album/
dest_dir/Not in any album/12345.jpg -> ../photostream/12345.jpg
dest_dir/Albums/Waterfalls - 6789/
dest_dir/Albums/Waterfalls - 6789/1_12346.jpg -> ../../photostream/12346.jpg
dest_dir/Albums/Waterfalls - 6789/2_12347.jpg -> ../../photostream/12347.jpg
dest_dir/Collections/Nature - 2634-98761234/Waterfalls - 6789 -> ../../Albums/Waterfalls - 6789
dest_dir/Collections/Nature - 2634-98761234/Mountains - 6790  -> ../../Albums/Mountains - 6790

The metadata files contain JSON data dumped from the Flickr API. It's not the prettiest thing in the world... but it does contain all the necessary data in case you want to recover from it.

The album and collection directories contain symlinks to the files in the photostream. The symlink names in albums are numbered so as to preserve the order.

Routine status is printed to stdout by default. Errors are printed to stderr. To see more options run with the --help flag.

Running unit tests

Run py.test.


  • Mirror comments
  • Store order of photos in photostream
  • Store order of albums in collections
Something went wrong with that request. Please try again.