Giter VIP home page Giter VIP logo

iphoto-dirtree-to-flat-tree's Introduction

iphoto-dirtree-to-flat-tree

A bash script to convert the directory tree and image files created by iphoto in to a flat single directory. This is useful for people who no longer use iphotos, and want to more easily view their old photos on a Linux computer. It copies the old files in to flattened version of the directory tree structure created by iphotos. It gives each file a unique name based on it's location in the original directory structure.

Example

If the input source directory contains directories and files like this:
./pictures/iPhoto Library.photolibrary/Masters/2014/11/23/1234/birthday.mov, ./pictures/iPhoto Library.photolibrary/Masters/2016/03/16/1234/barbecue.jpg, ./pictures/iPhoto Library.photolibrary/Masters/2017/09/03/1234/beach.png

This script will output the following in to the destination directory:
2014-11-23-1234-birthday.mov, 2016-03-16-1234-barbecue.jpg, 2017-09-03-1234-beach.png

Test Mode

./convert_files.sh by default (Meaning no source or destination directory arguments given) is run in test mode. Test mode will create a 'Masters/' directory and a 'converted_files/' directory in the current working directory. 'Masters/' will contain 4 folders, with 5 jpgs located in the end/bottom directory of each. Test will then copy/rename the 20 files over in to 'converted_files/'.

I recommend you try out the test mode first, to make sure it works the way that you want it to.

Instructions

  1. Clone the repository locally to your machine.

    • Open up terminal
    • Go to desired directory e.g. cd ~\myNewDirectory
    • Enter in git clone https://github.com/ryanpaixao/iphoto-dirtree-to-flat-tree
  2. Go into newly cloned repository's directory

    • Enter in cd ./iphoto-dirtree-to-flat-tree
  3. Run the convert_files.sh script in the default test mode

    • Enter in ./convert_files.sh
      • A prompt will appear asking if you want to run it in test mode.
    • Enter in y
  4. Check that the test mode created the source directory 'Masters/' and the destination directory 'converted_files/'

    • Use ls to see that both directories are present
    • Enter in cd ./Masters to check 'Masters/' directory contains 4 directories
    • Enter in cd ../converted_files, and see that there are 20 files present (created from 4 different folders containing 5 files)
    • Return to the parent directory by entering in cd ..
  5. Once you have check that test worked sucessfully, run the convert_files.sh script. Make sure to supply it with the source directory location and the destination directory location.

    • The source directory should not be a sub-directory of iphoto's 'Masters/' directory. For this to work you have to specifiy the exact location of 'Masters/'.
    • e.g. If source is './my/old/source/directory/Masters' and the destination is './my/new/destination/directory' then you would use the command: ./convert_files.sh ./my/old/source/directory ./my/new/destination/directory
  6. Check your destination directory. All you files should be there, copied over, and renamed!!

Change Log

v1.2
  • Fix space character in dir/file name issue.
v1.1
  • Add error handling. Add LICENSE.
v1.0
  • initial version

Error Log

Before the copying process starts, a 'convert_files_error.log' file is created with the time and date at the top of the log. If an error occurs during the copy process, the source and destination paths/name will be recorded in the log. Check the log after the copying is finished.

Troubleshooting

  1. If you attempt to run ./convert_files.sh and you get an error message saying "Permission denied", do the following:
    • enter in sudo chmod 755 ./run_first.sh
      • You will have to enter in your root password
    • enter in ./run_first.sh
      • The scripts should now have full permission to run
  2. If you're still getting "Permission denied" messages, try running sudo ./convert_files.sh. It's possible that your source directory requires higher permission levels to have the files copied.

iphoto-dirtree-to-flat-tree's People

Contributors

ryanpaixao avatar

Stargazers

 avatar  avatar

Watchers

 avatar

iphoto-dirtree-to-flat-tree's Issues

Space in directory name throws error.

Description:

Entering in a source path that contains spaces in one of the directory names throws a "is not a valid source Path!" error.

Example:

source path: ./dir\ containing\ spaces/Masters

error returned: './dir' is not a valid source Path!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.