Register
It is currently Sun Sep 21, 2014 8:09 pm

PDF Backup to new Volume


All times are UTC - 6 hours


Post new topic Reply to topic  [ 5 posts ] 
Author Message
 PostPosted: Thu Sep 09, 2010 6:30 am   

Joined: Thu Sep 09, 2010 6:22 am
Posts: 3
Hi, I have a volume named "STUDIO" which contains all the usual working files. I am looking for a way to copy the PDF files only preserving the folder structure (and ignoring any folders that do not contain a pdf file) to a new Volume named "PDFs"

Ideally, it would be a 1 line code eg. find /Volumes/STUDIO -iname *.pdf -exec cp {} /Volumes/PDFs
or similar. I've done it once before but cannot remember how.

Here is an example of what I want.

STUDIO/MyFolder/MySubfolder/MyFile.pdf
STUDIO/MyFolder/MySubfolder_2/MyFile.indd

Should result in:
PDFs/MyFolder/MySubfolder/MyFile.pdf

Please help

Thanks


Top
 Profile  
 PostPosted: Thu Sep 09, 2010 7:16 am   
User avatar

Joined: Tue Apr 27, 2010 2:28 pm
Posts: 172
Location: Czech Republic
Code:
rsync -avm -f'+ */' -f'+ *.[pP][dD][Ff]' -f'- *'  /Volumes/STUDIO /Volumes/PDF


Top
 Profile  
 PostPosted: Thu Sep 09, 2010 7:24 am   

Joined: Thu Sep 09, 2010 6:22 am
Posts: 3
Thanks choroba,

That almost worked but it produces the result:

PDFs/STUDIO/MyFolder/MySubfolder/MyFile.pdf

Is there anyway to not have the STUDIO folder? IE:

PDFs/MyFolder/MySubfolder/MyFile.pdf

Thanks


Top
 Profile  
 PostPosted: Thu Sep 09, 2010 3:45 pm   
User avatar

Joined: Tue Apr 27, 2010 2:28 pm
Posts: 172
Location: Czech Republic
MarkJeater wrote:
Is there anyway to not have the STUDIO folder? IE:

Just add a slash after the STUDIO in the command :-B
Another nice feature of rsync is that when you run in again, it copies only the files that have changed, i.e. it's pretty quick.


Top
 Profile  
 PostPosted: Fri Sep 10, 2010 4:37 am   

Joined: Thu Sep 09, 2010 6:22 am
Posts: 3
Oh my god, that was so simple and yet I spent hours on it.

Cheers


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP