- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: find command
Operating System - HP-UX
1753792
Members
7557
Online
108799
Solutions
Forums
Categories
Company
Local Language
юдл
back
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
юдл
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
тАО01-20-2003 01:31 AM
тАО01-20-2003 01:31 AM
find command
I need help to setup a find command that delete all files in one directory except 2 files. Theese 2 files have always the same names.
The 2 files a will save is
08312783_udg_02.mfg.7
08312783_udg_02.asm.9
Is it possible to delete all the files except theese two.
I have attached the index of the directory to better understanding.
The 2 files a will save is
08312783_udg_02.mfg.7
08312783_udg_02.asm.9
Is it possible to delete all the files except theese two.
I have attached the index of the directory to better understanding.
- Tags:
- find
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-20-2003 01:38 AM
тАО01-20-2003 01:38 AM
Re: find command
Here is the find command to delete only the files in the current dir (NO subdirs). You must cd to the dir you want to remove the files from first. Note the 2 exclude statements for your 2 files (! -name "<1st file>" ! -name "<2nd file>"
find . \( -type d ! -name . -prune \) -o \( -type f -name "*" ! -name "." ! -name "08312783_udg_02.mfg.7" ! -name "08312783_udg_02.asm.9" -print \) -exec rm {} \;
Note this command should all be on on line, the formatting on the itrc website sometimes chops things up. Test if first without the -exec rm to be safe.
find . \( -type d ! -name . -prune \) -o \( -type f -name "*" ! -name "." ! -name "08312783_udg_02.mfg.7" ! -name "08312783_udg_02.asm.9" -print \) -exec rm {} \;
Note this command should all be on on line, the formatting on the itrc website sometimes chops things up. Test if first without the -exec rm to be safe.
Im from Palmerston North, New Zealand, but somehow ended up in London...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-20-2003 01:46 AM
тАО01-20-2003 01:46 AM
Re: find command
find -type f -name "*" | grep -v 08312783_udg_02.mfg.7| grep -v 08312783_udg_02.asm.9|xargs rm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-20-2003 02:41 PM
тАО01-20-2003 02:41 PM
Re: find command
find -type f -name "*" | grep -v 08312783_udg_02.mfg.7| grep -v 08312783_udg_02.asm.9|xargs rm
Never stop "LEARNING"
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP