Is there a way to search through a users dir and delete anything that is from the year 2000 and older with one command. I can remove each file individualy but there are over 600 files that they have.Thanks for he help!
Use the 'touch' command to create a file with a timestamp of the oldest file you want to keep.
Use the 'find' command to find all files older than the reference file you created in step 1. The find command can also execute commands (eg. rm) on all the files which it finds.
find /home/user -type f ! -newer /tmp/stamp.$$ > /tmp/rmfile
so I could see want files were going to be deleted. All the files that are sent to rmfile are files newer then 2000. As I am a novice to UNIX...I'm I just not getting it? I did put a space between the F and the ! and the -newer.
Sorry, don't understand why it's not working for you.
Seems like the solaris find command checks the inode change time instead of modification time (?).
Thank you both for your help!!!! I'm going to play around with the differnt commands to see what works. I'll post the command that work. Again thank you!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.