- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Help on the shell script.
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
05-24-2006 02:05 AM
05-24-2006 02:05 AM
Help on the shell script.
find /psoft -mtime +30 -name "PSDSTSRVLOG" -prune -o -name "PSPRCSRVLOG" -prune -o -name "TUXLOG" -prune -o -print | xargs rm -rf
Is there any way I can shorten this command while accommodating more directory names?
for examles.
prune_dir_list=PSDSTSRVLOG PSPRCSRVLOG TUXLOG TUXLOG2 TUXLOG3 TUXLOG4..
find /psoft -mtime +30 -name $prune_dir_list -prune -o -print | xargs rm -rf
Thanks,
Gulam.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2006 02:11 AM
05-24-2006 02:11 AM
Re: Help on the shell script.
prune_dir_list="PSDSTSRVLOG PSPRCSRVLOG TUXLOG TUXLOG2 TUXLOG3 TUXLOG4"
for x in $prune_dir_list
do
find /psoft -mtime +30 -name ${x} -prune -o -print | xargs rm -rf
done
...jcd...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2006 02:12 AM
05-24-2006 02:12 AM
Re: Help on the shell script.
You could use a pattern file with 'grep' to perform filtration, something like:
# find /path -xdev -type f -mtime +30 | grep -v -f /tmp/skippatterns | xargs ls -l
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2006 02:20 AM
05-24-2006 02:20 AM
Re: Help on the shell script.
you may also want to have a look at the gnu version of find, which has a wide range of additional useful parameters, documented at:
http://www.gnu.org/software/findutils/manual/html_mono/find.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2006 04:49 AM
05-24-2006 04:49 AM
Re: Help on the shell script.
you can generate an option list for find:
prune_dir_list='PSDSTSRVLOG PSPRCSRVLOG TUXLOG TUXLOG2 TUXLOG3 TUXLOG4'
findopt='-mtime +30'
for entry in $prune_dir_list
do findopt=$findopt" -name $entry -prune -o"
done
find /psoft $findopt -print ...
mfG Peter