Results 1 to 9 of 9

Thread: Un F-Spot-ing a photo collection

  1. #1
    Join Date
    Mar 2007
    Location
    Hampshire, England
    Beans
    229
    Distro
    Xubuntu

    Un F-Spot-ing a photo collection

    I maintain a computer running Ubuntu 10.04 for my family which contains our entire photo collection. I was using F-Spot to manage it but, to be honest, I'm not massively keen on F-Spot. Every time I remove all the duplicates, a few weeks later a load more seem to have appeared.

    Anyway, F-Spot imports photos in to the /home/<user>/Photos folder, and puts them in Year/Month/Day directories, presumably for its date slider thing across the top to work properly. Can anyone think of a good way to remove all the photos from their sub, sub-sub, and sub-sub-sub directories and put them all in one big directory? I guess a nice bash script would do the job, anyone willing to get me started?!

  2. #2
    Join Date
    Jan 2008
    Location
    Manchester UK
    Beans
    13,573
    Distro
    Ubuntu

    Re: Un F-Spot-ing a photo collection

    Code:
    find ~/Photos -name *.jpg -exec mv '{}' ~/one_big_folder \;
    That assumes all your photos end with .jpg.

    You have to create ~/one_big_folder (or whatever) first.

    If the are all different file extentions but you have no other type of files in you Photos directory an downwards

    Code:
    find ~/Photos -type f -exec mv '{}' ~/one_big_folder \:
    That will mv any file to one big folder, without moving the directories

  3. #3
    Join Date
    Mar 2007
    Location
    Hampshire, England
    Beans
    229
    Distro
    Xubuntu

    Re: Un F-Spot-ing a photo collection

    Thanks very much nothingspecial, very helpful.

  4. #4
    Join Date
    Oct 2005
    Location
    Connecticut, USA
    Beans
    1,545
    Distro
    Ubuntu

    Re: Un F-Spot-ing a photo collection

    Quote Originally Posted by Ozor Mox View Post
    I maintain a computer running Ubuntu 10.04 for my family which contains our entire photo collection. I was using F-Spot to manage it but, to be honest, I'm not massively keen on F-Spot. Every time I remove all the duplicates, a few weeks later a load more seem to have appeared.

    Anyway, F-Spot imports photos in to the /home/<user>/Photos folder, and puts them in Year/Month/Day directories, presumably for its date slider thing across the top to work properly. Can anyone think of a good way to remove all the photos from their sub, sub-sub, and sub-sub-sub directories and put them all in one big directory? I guess a nice bash script would do the job, anyone willing to get me started?!
    Yeah, I've never like that structure either. Plus, it looks like Shotwell is gaining momentum and is to be the default in future Ubuntu releases (at least the Netbook I think).
    Last edited by Dragonbite; May 14th, 2010 at 06:20 PM. Reason: refered to Spotify when wanted to refer to Shotwell
    Friends don't let friends wear a red shirt on landing-party duty.
    DACS | Connecticut LoCo Team | My Blog
    Ubuntu User# : 17583, Linux User# : 477531

  5. #5
    Join Date
    Mar 2006
    Location
    Williams Lake
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Un F-Spot-ing a photo collection

    Moved to General Help, as this doesn't belong in the Cafe.

  6. #6
    Join Date
    Oct 2005
    Location
    Connecticut, USA
    Beans
    1,545
    Distro
    Ubuntu

    Re: Un F-Spot-ing a photo collection

    Quote Originally Posted by nothingspecial View Post
    Code:
    find ~/Photos -name *.jpg -exec mv '{}' ~/one_big_folder \;
    That assumes all your photos end with .jpg.

    You have to create ~/one_big_folder (or whatever) first.

    If the are all different file extentions but you have no other type of files in you Photos directory an downwards

    Code:
    find ~/Photos -type f -exec mv '{}' ~/one_big_folder \:
    That will mv any file to one big folder, without moving the directories
    Can you break the command down? I want to understand what it's doing and everything.

    So find ~/Photos -name *.jpg means find in the Photo's directory (off the /home/<username>/ directory) all files with name ending in .jpg.

    And -exec mv '{}' ~/one_big_folder \; means to execute the mv (move) command, but what is the '{}' for? Is that a placeholder for the file the find found?

    I know the ~/one_big_folder is the destination, and what is that last \; for?
    Friends don't let friends wear a red shirt on landing-party duty.
    DACS | Connecticut LoCo Team | My Blog
    Ubuntu User# : 17583, Linux User# : 477531

  7. #7
    Join Date
    Jan 2008
    Location
    Manchester UK
    Beans
    13,573
    Distro
    Ubuntu

    Re: Un F-Spot-ing a photo collection

    Quote Originally Posted by Dragonbite View Post
    Can you break the command down? I want to understand what it's doing and everything.

    So find ~/Photos -name *.jpg means find in the Photo's directory (off the /home/<username>/ directory) all files with name ending in .jpg.

    And -exec mv '{}' ~/one_big_folder \; means to execute the mv (move) command, but what is the '{}' for? Is that a placeholder for the file the find found?

    I know the ~/one_big_folder is the destination, and what is that last \; for?

    Yep '{}' means everything that find has found

    ; ends the exec command the escape \ stops the shell as interpreting it as the the end of the find command. You could type
    Code:
    '{} ;'
    instead of '{}' \; in the same way as you cd into a directory wiyh a space in it`s name.

    I don`t actually know why you have to end the -exec, I just know you have to.

    While we are on the subject, it is advised to run the command without the -exec bit first just to check which files exec is going to manipulate.

    For example, the op wanted to move every photo into his ~/Photos folder
    he could have done
    Code:
    cd ~/Photos
    find ./ -type f -exec mv '{}' ./ \;
    ./ means "this directory"

    if he forgot to cd into the Photos directory he would have moved every file (Videos, mp3s, configs, icon pngs --- the lot) into his home directory. Find is recursive by default although you can specify how many levels it will traverse through the file system.

    If he`d done it from / .......
    Last edited by nothingspecial; May 14th, 2010 at 06:13 PM.

  8. #8
    Join Date
    Jan 2008
    Location
    Manchester UK
    Beans
    13,573
    Distro
    Ubuntu

    Re: Un F-Spot-ing a photo collection

    DO NOT PUT THIS IN A TERMINAL, IT IS FOR ILLUSTRATION ONLY

    Thinking about it abit more, the next step would be

    Code:
    find ./ -type d -exec rm -r '{}' \;
    Which would find and remove all the (now empty) directories.

    Of course, if you`d already done the first bit from the wrong directory, you'd have stuffed up your installation already and I don`t suppose that it would matter.

  9. #9
    Join Date
    Apr 2009
    Beans
    1,173

    Re: Un F-Spot-ing a photo collection

    Quote Originally Posted by Ozor Mox View Post
    Can anyone think of a good way to remove all the photos from their sub, sub-sub, and sub-sub-sub directories and put them all in one big directory?
    If you do this kind of thing too infrequently to remain familiar with the command line, then a regular search and move is effective:

    Using Places -> Search for Files, find all your images. Select them in the list (click the first and shift-click the last to select all) and drag them to another location - press shift when dragging to actually move rather than copy them.

    Using a dual-pane file manager like Krusader, select all the images into a list-box and move them.

    Using gThumb, run a search and move them from the image browser.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •