Questions? Feedback? powered by Olark live chat software
Knowledgebase
Author Avatar

Tar Recursively Including File Pattern

Written by: on 24 June 2015 12:48 PM 24 June 2015 12:48 PM

To tar/gzip all PHP files within a folder recursively read the following command and do it yourself.

To tar/gzip all PHP files within a folder recursively you would enter the root directory you want to recurse, and issue the following command in SSH to include all php and html files (this is a foolproof way which requires two commands but works regardless of the number of files):

find ./ -name "*.php" -o -name "*.html" > /root/filelist
tar -czvf /root/archive.tar.gz -T /root/filelist

(0 vote(s))
Helpful
Not helpful