Operating System - HP-UX
1850158 Members
2137 Online
104050 Solutions
New Discussion

Re: Help with old user cleanup

 
SOLVED
Go to solution
Robert Butler_1
New Member

Help with old user cleanup

Hello,

I am cleaning up old users off the HP-UX. I can do:
find / -name xxxx
and list the files that they have created or have ownership to. Is there a way to pipe this into a tar or similar command to create a single file with their old files before I run a find command to remove the files?
5 REPLIES 5
Dan Hetzel
Honored Contributor
Solution

Re: Help with old user cleanup

Hi Robert,

find / -user xxxx | xargs tar cvf /dev/rmt/0m
should do the trick.

Best regards,

Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
Rita C Workman
Honored Contributor

Re: Help with old user cleanup

How about this:

find / -name xxx -exec mv {} /newdir/dir/ \;

/rcw
Dan Hetzel
Honored Contributor

Re: Help with old user cleanup

Hi again,

Forgot to mention that with the -user option, if the next argument isn't a login name, it will be taken as numeric.
This is useful if you remove files from users already deleted from /etc/passwd.

All the best,

Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
Andreas Voss
Honored Contributor

Re: Help with old user cleanup

Hi,

for this purpose i would recommend cpio:

find / -name xxxx | cpio -oc | gzip -c >userfiles.cpio.gz

I have used gzip to reduce disk usage.
To restore something you could use:

gzip -dc < userfiles.cpio.gz |cpio -imdvc

Regards
Robert Butler_1
New Member

Re: Help with old user cleanup

Thank you all.

I think I'll go with Dan's approach and put to a tar file which I'll gzip up. Once all the old users files are created I can move them to tape.