- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Scripting deleting files older than XX number of d...
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
Discussions
Discussions
Forums
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
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
тАО02-24-2005 09:06 PM
тАО02-24-2005 09:06 PM
Every day we FTP a lot of files to and from legacy systems. What I would like to know (and how to do it) is that is it possible to write a simple script to check a certain file system path for any files that are 90 days or older and delete them. (Instead of me manually removing them each month)
of course I don't want to search the whole system. These files are held in their own file system;
/interface/
(there are several interfaces and we would have to look at each one.
We would put this script in the cron.
many thanks
Chad.
Solved! Go to Solution.
- Tags:
- find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2005 09:17 PM
тАО02-24-2005 09:17 PM
Re: Scripting deleting files older than XX number of days
# find /filesystem -mtime +90 -type f -exec ll {} \;
try above command to list files older then 90 days, if it works change the ll into rm. You clould also add this command into a script.
Hope this helps,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2005 09:17 PM
тАО02-24-2005 09:17 PM
Re: Scripting deleting files older than XX number of days
Use the find command in cron to remove old log files:
The following command will delete the files which are not accessible for last 90 days.
find /interface/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2005 09:18 PM
тАО02-24-2005 09:18 PM
Re: Scripting deleting files older than XX number of days
-mtime +90 -exec rm {} \;
assuming you're deleting files on the system you're logged into and not a remote system.
Mark Syder (like the drink but spelt different)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2005 09:29 PM
тАО02-24-2005 09:29 PM
Re: Scripting deleting files older than XX number of days
Thanks for the replies.
I've entred the command below to test lisitng the files before using the rm command:
find /interface/DEV/BACS -mtime +90 -exec ls {}\;
but I get the error
find: -exec not terminated with ';'
Am I missing something?
Chad (like the African Country but it's really my name)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2005 09:30 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2005 09:33 PM
тАО02-24-2005 09:33 PM
Re: Scripting deleting files older than XX number of days
Thanks all
Thanks for your speedy responses.
Chad.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2005 09:34 PM
тАО02-24-2005 09:34 PM
Re: Scripting deleting files older than XX number of days
Thanks