- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Shell scripts help - find deletes the base dir...
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
тАО06-07-2006 05:00 AM
тАО06-07-2006 05:00 AM
Shell scripts help - find deletes the base dir.
#!/usr/bin/sh
nod=60
dir1=/psoft/prcs/log_output
find $dir1 -mtime +$nod -name "_PSDSTSRVLOG" -prune -o -name "_PSPRCSRVLOG" -prune -o -name "_TUXLOG" -prune -o -print | tee /psoft/log_fstrn8.txt | xargs rm -rf
Thanks,
Gulam.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 05:02 AM
тАО06-07-2006 05:02 AM
Re: Shell scripts help - find deletes the base dir.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 05:05 AM
тАО06-07-2006 05:05 AM
Re: Shell scripts help - find deletes the base dir.
Thanks,
Gulam.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 05:11 AM
тАО06-07-2006 05:11 AM
Re: Shell scripts help - find deletes the base dir.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 05:13 AM
тАО06-07-2006 05:13 AM
Re: Shell scripts help - find deletes the base dir.
find $dir1/. -mtime ..........
you will get an error stating rm: cannot remove .. or ., but all below $dir will be gone.
...jcd...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 05:33 AM
тАО06-07-2006 05:33 AM
Re: Shell scripts help - find deletes the base dir.
you can explicitly skip it:
...
find $dir1 -mtime +$nod -name "_PSDSTSRVLOG" -prune -o -name "_PSPRCSRVLOG" -prune -o -name "_TUXLOG" -prune -o -print | tee /psoft/log_fstrn8.txt |
fgrep -vx $dir1 | xargs rm -rf
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 05:33 AM
тАО06-07-2006 05:33 AM
Re: Shell scripts help - find deletes the base dir.
If I changed it to $dir/. then it deltes all files/subdir under log_output just keepling following two pruned subdir
total 108
drwxr-x--- 2 fstrn8 psoft 39936 Jun 7 05:22 _PSDSTSRVLOG
drwxr-x--- 2 fstrn8 psoft 15360 Jun 7 12:34 _PSPRCSRVLOG
Thanks,
Gulam.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 05:51 AM
тАО06-07-2006 05:51 AM
Re: Shell scripts help - find deletes the base dir.
cd $dir1
find . -mtime +$nod -name "_PSDSTSRVLOG" -prune -o -name "_PSPRCSRVLOG" -prune -o -name "_TUXLOG" -prune -o -print | tee /psoft/log_fstrn8.txt | xargs rm -rf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 09:00 AM
тАО06-07-2006 09:00 AM
Re: Shell scripts help - find deletes the base dir.
find ${dir1}/* ...rest of options...
${dir1}/* is replaced with a list of all the items in $dir1 but not the directory itself.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 07:00 PM
тАО06-07-2006 07:00 PM
Re: Shell scripts help - find deletes the base dir.
do a 'touch $dir1' before you start.