- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Automatic File Removal script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2002 02:15 AM
07-31-2002 02:15 AM
Many thank's
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2002 02:17 AM
07-31-2002 02:17 AM
Re: Automatic File Removal script
find . \! -mtime 5 -exec rm -f {} \;
test first!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2002 02:24 AM
07-31-2002 02:24 AM
Re: Automatic File Removal script
cd
find . -mtime +
The +
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2002 02:35 AM
07-31-2002 02:35 AM
Re: Automatic File Removal script
=
-mtime +7
but older (read very old) find versions do not support + notation
exclamation mark is 'not' or 'reverse' and is escaped for (t)csh users
HTH
BTW GNU find has many more nifty features
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2002 02:37 AM
07-31-2002 02:37 AM
Re: Automatic File Removal script
find
here if u say 5 it deletes files which are modified exactly 5 days back, if us say +5 it deletes files modified 5 or more days back, and -5 deletes files which are modified during last 5 days. here mtime modification time, u can also specify atime (accessed time) there.
type f indicates it is a file.
regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2002 02:41 AM
07-31-2002 02:41 AM
Re: Automatic File Removal script
I would use something like:
find /your/log/path -name "*log" -mtime 5 | xargs rm
The xargs is a bit better on performance than find/exec. The use of a full path means you won't remove anything from another path, and the -name part again limits what you will be deleteing.
Cheers!
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2002 03:02 AM
07-31-2002 03:02 AM
Solutionfind /ORACLE_ARCH_DIR -mtime +5 -name "ora_arch*" -type f -exec rm -f {} \;
In UNIX you have to make sure you protect yourself from making mistakes else the results can be catastrophic...
George
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2002 03:17 AM
07-31-2002 03:17 AM
Re: Automatic File Removal script
1st it prints the list of file we're about to delete, then run the deletion.
We delete files with different patterns.
See attachment
Jean-Luc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2002 02:50 PM
08-01-2002 02:50 PM
Re: Automatic File Removal script
Some of proposed solutions are simple but realy dangerous. Removal of old files sometimes can be very tricky. There are 2 MUST rules for any script or program performing cleanup of filesystem
1. Do not follow symlinks in the directories (even if it is the top level directory for cleaning).
2. Remove only regular files and EMPTY directories.
Personally I prefer to use a 'tmpwatch' program which comes with many versions of RedHat Linux. Source code is available on Redhat web site.
The source is tested to compile and work correctly on
HP-UX as well.
Vytas.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2002 06:42 PM
08-01-2002 06:42 PM