Script for delete tmp files older than 15 days and owned by "xxx" id

Hi All ,

I want to delete files from /tmp directory created by "xxxx" id.
because i got the list says more than 60 thousand files were created by "xxxx" id since 2002.
The /tmp directory has lot of files created by different user ids like root,system etc..

But, i need a script to delete the files OLDER THAN 15 days and created by "XXXX" user id. Just i want to keep 15 days temp files.

could any one please help me !!!

Thanks is Advance !!!

use find...

would suggest you get a list, then loop over it and delete files - then you have a record. e.g.

# cd /tmp
# find . -user xxx -mtime +15 > filelist

#  while read f; do rm $f; done <filelist

HTH

can also be done in a single find command,

find . -user xxx -mtime +15 -ok rm {} \;

If that list is for confirmation, just execute the find command and confirm. And finally use -ok to delete or skip each & every file.

If you want to delete all files without confirmation use -exec instead of -ok.