• moving photos from many disorganised places into a single directory and not overwriting files of the same name


    Hi All.

    Being a keen photographer and technologist I’ve tried many photo software and many operating systems.

    I’ve accumulated lots of duplicates (most of these are probably just whole backups of my entire photo collection stored in different folders).

    Before trying to 1) remove the duplicates and then 2) sort the photos into an easily understandable folder structure using a method similar to the following tutorial, https://goo.gl/RMOzWT, I would like to:

    A) Move or Copy all the photos (.cr2, jpg) into a single folder called photos, but to complicate it I would like to do that without overwriting the the files if they have the same name. For example there may be two photos with the same name (since cameras have bad default names) but which aren’t duplicate photos.

    If they are coming from difference source directories (say 2010 photo backup & 2014 photo backup) to be moved into the one folder, “All Photos” how can I say move or copy them in and give them both a unique name in all cases?

    I’m basically looking for the rename feature such as in windows, which gives every file a (1) or (2) on the end of it, but without obviously having to sit by the file manager and click the rename button each time ( I have too many photos).

    I was thinking maybe a sequence to be able to do this would be:

    UNLESS there is a way of using EXIFTOOL or another tool to rename the files giving them unique names while they are all being copied to a single folder.

    • then use exiftool to rename files according to a name which makes sense, like datae YYYY-MM-DD HHMMSS AM/PM then a #Number

    • Then lastly transfer these correctly named files into folders by year and month

    2015

    • 01Jan

    • 02Feb

    2014

    • 01Jan

    • 02Feb

    etc

  • Hi,

    You can use something like FSLint to find and remove duplicates:

    yaourt -S fslint
    
  • Hi
    Have you looked at Rapid Photo Downloader? This is available in the community repository.

    Under File>Preferences>Devices you can specify the exact location to import photos from e.g. on your hard drive if you disable the automatic option (it’s designed to automatically import from cameras).
    Under File>Preferences>Error Handling you can choose to add a unique identifier to a photo with a duplicate name.
    Under File>Preferences>Photo Folders you can specify the naming system for any folders for your photos.
    Under File>Preferences>Photo Rename you can specify how photo files are renamed if you wish to do so.

    I normally use Rapid Photo Downloader for importing photos and videos from my camera, it’s very versatile and reliable, although it doesn’t yet work for Android devices.

  • Thanks Guys. Lots.0.logs I will use FSLINT when I get all the photos inside one folder. My issue is not getting the photos from my camera or android device but consolidating the files from my hard drive (some duplicates and some just sprawled everywhere in multiple directories) into a single folder and renaming them (so that they don’t get overwritten based on filename).

    I thought the community would be the best to know about a script or terminal command that would consolidate the files into one directory and give them unique names. (because if I copy files of the same name they will be overwritten).

  • @Yoshiserry This is Linux, of course there’s a way to do it. In fact, I’m sure there are MANY ways to do it. If you want to keep it simple you could do something like this:

    #!/bin/bash
    
    # Which directory should be recursively searched for images?
    SEARCH_IN_DIR="/some/dir"
    # Where should the images be moved to?
    MOVE_TO_DIR="/some/other/dir"
    
    # There's no turning back now...
    find "${SEARCH_IN_DIR}" -type f -iname '*.gif' -o -iname '*.jpg' -o -iname '*.bmp' -o -iname '*.png' -exec mv --backup=t {} "${MOVE_TO_DIR}" \;
    

    Hope that helps. Cheers!

  • Hi

    Just to clarify, Rapid Photo Downloader can be used to move existing photos from your hard drive to another directory and add a unique identifier to photos that appear to be duplicates.

  • Xler8 - IF rapid photo downloader can do that I think it best I look into that. Do you have an example of setting Rapid Photo downloader to give unique names to the ones it thinks are duplicates? How does it detect duplicates? - By name only?

    Lots.0.logs Your terminal solution with your bash script also looks simple, however when I look at that script I can’t see any way that it would deal with two files of the same name? say “canon_0001”, and keep them both?

  • @Yoshiserry The --backup argument to the mv command takes care of that automatically :smile:

  • Hi Yoshiserry

    As I’ve never used Rapid Photo Downloader in this way, I tried the following:

    Copied photos from a directory to a new directory on my hard drive, photos kept the original file names, etc.
    Set up Rapid Photo Downloader using the settings shown in my original post.
    Used Rapid Photo Downloader to copy the photos from the new directory back into the original directory three times.
    Each photo was saved three times, in addition to the original.
    Files were named with ‘_1’, ‘_2’ etc. added to file name, screenshot attached:

    Screenshot from 2015-05-11 11-50-55.png

    You would need to point it at each directory where your photos are stored. I’m not sure how it recognises duplicates, I assume it’s from the file name. It takes a few minutes to set up the various options but it’s a very versatile programme.

    Hope it’s what you’re looking for!

  • Hi

    If you want to see more information, the web site for Rapid Photo Downloader is:

    http://www.damonlynch.net/rapid/

  • Xlr8 thanks for that i’ll definitely check out the program sounds extremely useful.

photos1 canon5 cr22 jpg2 duplicates1 Posts 11Views 3143
Log in to reply