- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: batch compressing dated files
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
03-25-2003 06:53 AM
03-25-2003 06:53 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2003 06:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2003 06:59 AM
03-25-2003 06:59 AM
Re: batch compressing dated files
# cd
# find . -type f -xdev -mtime +30 -exec gzip {} \;
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2003 07:01 AM
03-25-2003 07:01 AM
Re: batch compressing dated files
Try the following
find /start_dir -mtime +30 -a -name "2003*.*" -exec compress {} \;
Notes:
1) Replace /start_dir with a relevant dir root to ease the search burden
2) The -a is a logical AND operator in the command
3) Try the command first with ll in place of compress to verify just WHICH files will be compressed
4) I'd recommend gzip over compress - generally compresses better.
HTH,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2003 07:21 AM
03-25-2003 07:21 AM
Re: batch compressing dated files
I'll assume that you have cd'ed to the target directory.
P30FNAME=$(caljd.sh -y -s $(caljd.sh -p 30))".txt"
ls | while read FNAME
do
if [[ -f ${FNAME} ]]
then
if [[ "${FNAME}" < "${P30FNAME}" ]]
then
echo "Compress this file"
fi
fi
done
That should do it and here's caljd.sh to do the date calculations.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2003 07:21 AM
03-25-2003 07:21 AM
Re: batch compressing dated files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2003 07:24 AM
03-25-2003 07:24 AM
Re: batch compressing dated files
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2003 07:25 AM
03-25-2003 07:25 AM
Re: batch compressing dated files
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2003 07:25 AM
03-25-2003 07:25 AM
Re: batch compressing dated files
-mtime +X where X=# days is the time of last modification.
atime = access time
ctime = change of status time
Rgds,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2003 07:36 AM
03-25-2003 07:36 AM
Re: batch compressing dated files
find: cannot stat
/u/online/recpt_aud
????????
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2003 07:38 AM
03-25-2003 07:38 AM
Re: batch compressing dated files
The error, "cannot stat", means that there is no such directory in this case.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2003 07:40 AM
03-25-2003 07:40 AM
Re: batch compressing dated files
Pete
Pete