Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
add comment

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.

share|improve this answer
add comment

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 ".".

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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