- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Shell Script :- Compress files older than 3 days
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
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
тАО08-03-2004 04:05 PM
тАО08-03-2004 04:05 PM
Shell Script :- Compress files older than 3 days
Could anyone pls help me to write a script which will run everyday and compress all the files which are 3 days old(created) in three different directories.
With thanks & regards
-sinhass
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-03-2004 04:28 PM
тАО08-03-2004 04:28 PM
Re: Shell Script :- Compress files older than 3 days
Use the find command in a script.
find /
This will ensure you only find files in the directory specified not in any subdirectories.
Cheers
Con
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-03-2004 04:32 PM
тАО08-03-2004 04:32 PM
Re: Shell Script :- Compress files older than 3 days
You could also do this to compress files older than 3 days.
cd to the directory
find . -name "file_name" -mtime +3 -exec compress {} \;
IA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-03-2004 05:46 PM
тАО08-03-2004 05:46 PM
Re: Shell Script :- Compress files older than 3 days
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-03-2004 05:50 PM
тАО08-03-2004 05:50 PM
Re: Shell Script :- Compress files older than 3 days
Use any of the suggestion to compress file older than 3 days by incorporating the command in the script. Use cron to schedule the script to run every 3 days.
For more about cron please refer the following link
http://www.unixgeeks.org/security/newbie/unix/cron-1.html
--
M
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-04-2004 12:09 AM
тАО08-04-2004 12:09 AM
Re: Shell Script :- Compress files older than 3 days
The problem is that hp-ux does not track a "create" date.
It tracks an access, modify, and change date but not a creation date so if you have to use creation date, the script would have to keep track via diffed lls of the files that were now in the directory.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-04-2004 01:17 AM
тАО08-04-2004 01:17 AM
Re: Shell Script :- Compress files older than 3 days
http://www.shelldorado.com/
Will explain this to you that indeed you cannot find easily on a create date
If someone is using the file you do not want to compress it anyway
Find with -mtime +3 is the safest way to go
If I create a file and after 2 days zeroise it and put new contents it becomes to me new and not 2 days old
Steve Steel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-04-2004 04:14 AM
тАО08-04-2004 04:14 AM
Re: Shell Script :- Compress files older than 3 days
-Sinhass