I would like to find and gzip/tarball contents of all the folders matching wordpress in my directory, but I am having trouble trying to get the command to work, I thought it was something like

find * | tar -zcvf jdaniel/wp-all.tar.gz 'grep wordpress'

tar: Exiting with failure status due to previous errors

link|improve this question
feedback

2 Answers

up vote 0 down vote accepted

Do the search in the find command instead:

find ./ -iname '*wordpress*' | tar -zcvf jdaniel/wp-all.tar.gz

You could also add -type d to the find command, but not sure if that will skip the files in the directories when they are passed to the tar command.

link|improve this answer
feedback

If you want to archive all the directories in the current directory whose names include "wordpress", then just use this:

tar -zcvf jdaniel/wp-all.tar.gz *wordpress*

That assumes that you're not interested in directories beginning with ".".

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.