- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script help required - calling the guru's
Categories
Company
Local Language
Forums
Discussions
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Knowledge Base
Forums
Discussions
- Cloud Mentoring and Education
- Software - General
- HPE OneView
- HPE Ezmeral Software platform
- HPE OpsRamp
Knowledge Base
Discussions
Forums
Discussions
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
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-14-2004 01:02 AM
07-14-2004 01:02 AM
I have a directory containing many thousands of small files. Each day, about 20,000 files are added to this directory. Each night, a cron task runs to delete the files in this directory that are over 7 days old.
Instead of deleting the files, I need to archive them, but I'm concious of inode limits within filesystems.
Therefore, I'm looking for a script that will take the 20,000 or so files from one day, compress them into 1 file (using gzip?) and name that file as the date being compressed (eg. 140704.Z)
Anyone fancy a crack ??
Help will be rewarded generously!
Regards
Simon
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2004 01:13 AM
07-14-2004 01:13 AM
Solutionfind /20000directory -mtime +7 -print >/tmp/filelist
TARFILE=`/bin/date +%y%m%d%H%M%S`.tar
FILES=`cat /tmp/filelist`
tar cvf /archdir/$TARFILE $FILES
gzip /20000directory/$TARFILE
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2004 01:15 AM
07-14-2004 01:15 AM
Re: Script help required - calling the guru's
Modify your script to use GNU's tar (http://hpux.cs.utah.edu/hppd/hpux/Gnu/tar-1.14/).
When using GNU's tar, use the --gzip. Once you have archived the file, delete it.
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2004 01:27 AM
07-14-2004 01:27 AM
Re: Script help required - calling the guru's
find dir -mtime +7|xargs shar|gzip > $(/bin/date +%y%m%d%H%M%S).gz
Puts them in a compressed shared archive
Then remove them
Steve steel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2004 03:01 AM
07-14-2004 03:01 AM
Re: Script help required - calling the guru's
find /mydir -mtime +7 | tar cvf - | gzip > /mydir/$(date +%d%m%y).tar.gz
Enjoy :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2004 03:09 AM
07-14-2004 03:09 AM
Re: Script help required - calling the guru's
tar cvf - $( find /mydir -mtime +7 ) | gzip > /mydir/$( date +%d%m%y ).tar.gz