tar a directory and only include certain file types
Posted
by Susan
on Server Fault
See other posts from Server Fault
or by Susan
Published on 2010-03-30T17:51:35Z
Indexed on
2010/03/30
17:53 UTC
Read the original article
Hit count: 609
Following the instructions here: http://linuxdevcenter.com/pub/a/linux/lpt/20_08.html
I'm aiming to tar up a directory but only want to include .php files from that directory.
Given the aforementioned instructions, I've come up with this command. It creates a file called IncludeTheseFiles which lists all the .php files, then the tar is supposed to do it's job only using the files listed in IncludeTheseFiles
find myProjectDirectory -type f -print | \
egrep '(\.[php]|[Mm]akefile)$' > IncludeTheseFiles
tar cvf myProjectTarName -I IncludeTheseFiles
However, when I run this it doesn't like the I include option?
tar: invalid option -- I
© Server Fault or respective owner