Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 08-21-2009, 09:48 AM   #1
LQ Newbie
Registered: Nov 2008
Posts: 14

Rep: Reputation: 0
tar copy with include

Hello and happy friday,

I have 15gigs of images i need to move from ./originals/import_20090814 to ./images/assets/Static+Images. However my client is only wanting to copy the .pdf, .jpg and .eps files that are in the ./originals/imports_20090814/ directory. How would i do a tar copy to exclude? Is there a --include function like the --exclude function. Or maybe is it possible to use the --exclude flag to exclude everything except .jpg, .pdf and .eps? Couldnt find my answer in the man page. Thank you!

Last edited by eodchop; 08-21-2009 at 09:49 AM. Reason: spelling correction
Old 08-21-2009, 10:30 AM   #2
Registered: Jun 2005
Location: England
Distribution: Ubuntu, SLES, AIX
Posts: 268

Rep: Reputation: 47
You could use something like:

$ ls -1 /full/path/to/import_20090814/{*.pdf,*.jpg,*.eps} | xargs -i mv {} /full/path/to/Static+Images/

Last edited by rizhun; 08-21-2009 at 10:33 AM.
Old 08-21-2009, 11:46 AM   #3
LQ Newbie
Registered: Nov 2008
Posts: 14

Original Poster
Rep: Reputation: 0
Originally Posted by rizhun View Post
You could use something like:

$ ls -1 /full/path/to/import_20090814/{*.pdf,*.jpg,*.eps} | xargs -i mv {} /full/path/to/Static+Images/
That worked great thanks!


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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tar file copy error rays_pks Gentoo 1 06-17-2009 03:38 AM
Redundant Directory Copy w/ Tar carlosinfl Linux - General 3 03-20-2008 01:30 PM
need copy of tomcat 4 tar file Kaao Linux - Software 1 05-16-2006 01:20 PM
backup files, tar, do i need to make a copy dtra Linux - Software 3 05-10-2005 09:52 PM
tar command include option? x5452 Linux - General 7 05-20-2004 11:18 PM

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

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