Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

am trying to perform an update on multiple site that use an open source CMS but untaring a patch file in each sites httpdocs directory. My plan was to perform a find for the patch file then untar using the following command:

find . -name "patchfile.tar.gz" -exec tar -xzvf {} \; -print

but it doesnt seem to work successfully

anyone have any ideas as to why not?

Many thanks.

share|improve this question
up vote 0 down vote accepted

You are extracting the tar file in the current directory, not where the patch file is. You can write a small wrapper to extract the files in the desired directory, e.g.

DIR=`dirname $1`
cd $DIR
tar xzf $1

now the search command can be

find ... -exec {} \; ...
share|improve this answer

Your Answer


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.