Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

How can I write a script for finding the files created by a particular user ID in some locations and tar those files in the same location?

share|improve this question

migrated from Jul 13 '11 at 15:53

This question came from our site for professional and enthusiast programmers.

up vote 3 down vote accepted

Example creating a tarball of all files belonging to the root user anywhere beneath the current directory:

find . -uid 0 -print0|xargs -0 tar cf files-of-root-user.tar

You would replace -uid 0 with the id of the user you want to create the tar for.

share|improve this answer
Thank you soulmerge it worked. – user840963 Jul 12 '11 at 15:07

You must log in to answer this question.