LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Trying to extract original jpg files from IPhoto. (https://www.linuxquestions.org/questions/linux-software-2/trying-to-extract-original-jpg-files-from-iphoto-4175586218/)

pressman57 08-03-2016 07:39 PM

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.

jefro 08-03-2016 07:55 PM

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

24x7servermanagement 08-03-2016 08:32 PM

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.

pressman57 08-03-2016 08:51 PM

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.

ondoho 08-04-2016 12:50 PM

^ 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.

Janus_Hyperion 08-04-2016 03:03 PM

Quote:

Originally Posted by pressman57 (Post 5585575)
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.

pressman57 08-04-2016 07:38 PM

Quote:

Originally Posted by nonamedotc (Post 5586091)
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.

pressman57 08-04-2016 08:40 PM

Quote:

Originally Posted by ondoho (Post 5586016)
^ 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.

pressman57 08-05-2016 09:50 AM

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.

ondoho 08-05-2016 02:26 PM

Quote:

Originally Posted by pressman57 (Post 5586472)
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.


All times are GMT -5. The time now is 11:24 AM.