LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-03-2016, 08:39 PM   #1
pressman57
Member
 
Registered: Feb 2005
Location: Escondido Ca.
Distribution: Arch
Posts: 118

Rep: Reputation: 29
Trying to extract original jpg files from IPhoto.


My wife has an aging IMac and I'm trying to back up her .jpg's from her Pictures folder. I use rsync to back up her /User folder to a home server.

I thought it would be easy. Just look in Pictures. Here's the path of a single jpg:

/mnt/blah/Pictures/iPhoto\ Library/Masters/2016/07/10/20160710-213800/blah.jpg

It's obviously a convoluted mess for a reason, they want to lock you into iPhoto for ever and ever.

There has to be a way to burrow down into this hierarchy and copy the image files into a directory with bash, but I've been googling for over an hour and have come up empty. Is there a way to pipe the output of find to cp maybe?

Thanks for looking.
 
Old 08-03-2016, 08:55 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,274

Rep: Reputation: 3458Reputation: 3458Reputation: 3458Reputation: 3458Reputation: 3458Reputation: 3458Reputation: 3458Reputation: 3458Reputation: 3458Reputation: 3458Reputation: 3458
You can generally take most commands and pipe them to another operation in linux yes.
Some people used to make a text file and then check it then run it in a batch/script as input.
A lot folks here are pretty good on the programming forum and can give you 20 ways to do that.

Some gui/window file managers have ways to find also and then cut and paste.


http://stackoverflow.com/questions/5...ed-on-wildcard
 
1 members found this post helpful.
Old 08-03-2016, 09:32 PM   #3
24x7servermanagement
Member
 
Registered: Jul 2016
Location: India
Distribution: CentOS, Redhat, Ubuntu and Debian
Posts: 57

Rep: Reputation: Disabled
rsync -avrc -e -i `find . -type f -name *.zip` /lx24

Works pretty well for me. Change the things as per your requirement and give a try.
 
1 members found this post helpful.
Old 08-03-2016, 09:51 PM   #4
pressman57
Member
 
Registered: Feb 2005
Location: Escondido Ca.
Distribution: Arch
Posts: 118

Original Poster
Rep: Reputation: 29
Thanks for the replies. I tried the command above but it failed, probably because of my own ignorance. So you're using rsycnc using find to copy to the directory? Cool. I'll research rsync and find again tomorrow and see if I can make it work.

Hell let's sell it to disgruntled Mac forum users. We could make a fortune.
 
Old 08-04-2016, 01:50 PM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 18,394
Blog Entries: 12

Rep: Reputation: 5621Reputation: 5621Reputation: 5621Reputation: 5621Reputation: 5621Reputation: 5621Reputation: 5621Reputation: 5621Reputation: 5621Reputation: 5621Reputation: 5621
^ you probably have to replace *zip with *jpg, no?

anyhow, "find" can do it by itself if the photos are uniquely named:
Code:
find -iname '*.jpg' -exec cp -n {} /new/folder/{} \;
if they're not it's more difficult.
advanced cp utilities might exist that automatically rename.
or maybe rsync is the best solution after all.

Last edited by ondoho; 08-04-2016 at 01:53 PM.
 
1 members found this post helpful.
Old 08-04-2016, 04:03 PM   #6
Janus_Hyperion
Member
 
Registered: Mar 2011
Location: /
Distribution: Fedora (typically latest release or development release)
Posts: 372

Rep: Reputation: Disabled
Quote:
Originally Posted by pressman57 View Post
My wife has an aging IMac and I'm trying to back up her .jpg's from her Pictures folder. I use rsync to back up her /User folder to a home server.

I thought it would be easy. Just look in Pictures. Here's the path of a single jpg:

/mnt/blah/Pictures/iPhoto\ Library/Masters/2016/07/10/20160710-213800/blah.jpg

It's obviously a convoluted mess for a reason, they want to lock you into iPhoto for ever and ever.
If you do not have too many libraries, just open the library in iPhoto, export all the images (File --> Export) to a directory of your choosing and then copy that directory instead of dealing with this iPhoto path mess. This is what I did recently for my wife's ipad.

Hope that helps.
 
1 members found this post helpful.
Old 08-04-2016, 08:38 PM   #7
pressman57
Member
 
Registered: Feb 2005
Location: Escondido Ca.
Distribution: Arch
Posts: 118

Original Poster
Rep: Reputation: 29
Quote:
Originally Posted by nonamedotc View Post
If you do not have too many libraries, just open the library in iPhoto, export all the images (File --> Export) to a directory of your choosing and then copy that directory instead of dealing with this iPhoto path mess. This is what I did recently for my wife's ipad.

Hope that helps.
Probably what I'll end up doing. I just thought that one line of bash code could do the same thing.
 
Old 08-04-2016, 09:40 PM   #8
pressman57
Member
 
Registered: Feb 2005
Location: Escondido Ca.
Distribution: Arch
Posts: 118

Original Poster
Rep: Reputation: 29
Quote:
Originally Posted by ondoho View Post
^ you probably have to replace *zip with *jpg, no?
Yep.


anyhow, "find" can do it by itself if the photos are uniquely named:
Code:
find -iname '*.jpg' -exec cp -n {} /new/folder/{} \;
if they're not it's more difficult.
advanced cp utilities might exist that automatically rename.
or maybe rsync is the best solution after all.

The files are named after projects so, yeah,it could work.
 
Old 08-05-2016, 10:50 AM   #9
pressman57
Member
 
Registered: Feb 2005
Location: Escondido Ca.
Distribution: Arch
Posts: 118

Original Poster
Rep: Reputation: 29
Actually it did work. The exact command I used was:

find /mnt/blah/Pictures/iPhoto-Library/Masters/ -name "*.jpg" -type f -exec cp {} ./Dest_Dir \;

and
find /mnt/blah/Pictures/iPhoto-Library/Masters/ -name "*.JPG" -type f -exec cp {} ./Dest_Dir \;


Thanks for the input guys. This was fun.

Last edited by pressman57; 08-05-2016 at 10:56 AM.
 
Old 08-05-2016, 03:26 PM   #10
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 18,394
Blog Entries: 12

Rep: Reputation: 5621Reputation: 5621Reputation: 5621Reputation: 5621Reputation: 5621Reputation: 5621Reputation: 5621Reputation: 5621Reputation: 5621Reputation: 5621Reputation: 5621
Quote:
Originally Posted by pressman57 View Post
Actually it did work. The exact command I used was:

find /mnt/blah/Pictures/iPhoto-Library/Masters/ -name "*.jpg" -type f -exec cp {} ./Dest_Dir \;

and
find /mnt/blah/Pictures/iPhoto-Library/Masters/ -name "*.JPG" -type f -exec cp {} ./Dest_Dir \;


Thanks for the input guys. This was fun.
good.
please understand that cp will overwrite files with the same name, unless you use the -n flag.
and if you do use the -n flag, duplicate filenames are skipped silently.
i guess you could use the -i flag (interactive, see man cp) to make sure ALL files are copied.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] converting ppdf files to jpg files haroldapickering Linux - Newbie 2 03-01-2015 01:29 PM
rar extract files with the original owner, permissions etc. kartoffel Linux - Software 0 09-10-2014 12:44 PM
extract part of a string and reinsert back into original tlin Programming 5 02-15-2012 02:38 PM
Rename all ".JPG" files to ".jpg" under all subfolders... jiapei100 Programming 4 04-25-2010 07:27 PM
Convert many files to individual .bz2 files retaining original name? touser Linux - Newbie 5 03-29-2010 01:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration