Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Delete Directories based on mtime
Name: Sri123 Date: October 29, 2003 at 07:57:05 Pacific OS: HP-UX11 CPU/Ram: How do I find the Process
Comment:
Hi, I want to delete directories owned by ID1 if they are older than 2 days and also delete directories owned by rest of the ID's in the same directory, if they are older than 5 days. I was able to seperate the list of directories by their ID. How do I compare these directories' modification time with the current time to decide on whether to delete or not? Any Ideas...
You know, make a copy of things which you delete. tar -cf - -C /u/ID1 \ `find . -type d -mtime +2 -user ID1` \ |compress -C >> wech.tar.Z
NO RISK no Fun
Frank
0
Response Number 2
Name: Sri123 Date: October 29, 2003 at 09:52:24 Pacific
Reply:
Thanks for the info.. and your suggestion.
But, How do check the modification time of directories that doesn't belong to ID1 before deleting them?
Thanks
0
Response Number 3
Name: Frank Date: October 31, 2003 at 05:43:13 Pacific
Reply:
Hi,
just don't ask for the userId. If you delete 1 all directory's of ID1 which are older than 2 day's and than delete all directorys from all users (including ID1) which are older than 5 days than it is not nessecary to extract directorys of user ID1, because they was already deletet.
Summary: Does anyone have a script that will allow me to take the contents of a directory and delete files based on their age? Here's the scenerio. I have a directory that fills with report files. The files h...
Summary: Hi, I am new on Unix system, I am trying to delete a directory with files under it, and I am getting 'directory is not empt' message, any command I can use to delete directory plus files at once? Tha...
Summary: Dear Gurus, How do i delete files in a directory, based on a captured text file listing. E.g. ls {dir} > logfile.log rm {files listed in logfile.log} Please kindly advice. Thank you! Best Regards, And...