- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Simple script to delete 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
02-19-2002 11:58 AM
02-19-2002 11:58 AM
I need a script to go thur
all the files to find
Makefile.lcl and delete that file (but not delete Makefile).
I did a:
find / -name Makefile.lcl
and got 7 pages and I was
deleting them one a time and
I said hey a script could do
this.
I know it's very simple but
I can't afford to delete anything else (unemployment
seems scarey in today's
economy).
Could someone send me a
simple and safe delete script?
I'm using HP-UX 11.0 csh but
I'm open to any shell type.
TIA,
Laurie
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2002 12:07 PM
02-19-2002 12:07 PM
Re: Simple script to delete files
find / -name 'Makefile.lcl' -exec rm {} \;
I really prefer not to do a find from / but rather to cd to the desired directory and do a find . instead. Before you do the -exec rm {} \; I suggest that you find do a harmless command like -exec echo {} \; first.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2002 12:08 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2002 12:19 PM
02-19-2002 12:19 PM
Re: Simple script to delete files
find / -name Makefile.lcl -print | xargs rm -f
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2002 12:20 PM
02-19-2002 12:20 PM
Re: Simple script to delete files
#!/bin/sh
find / -name 'Makefile.lcl' > /tmp/make.list
for i in `cat /tmp/make.list`
do
rm $i
done
The find should work faster, but for loops will always be your friend.
GL,
C
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2002 12:29 PM
02-19-2002 12:29 PM
Re: Simple script to delete files
du -a |awk '$2 ~ "Makefile.lcl$" {print $2}|xargs rm