- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: How to exclude a directory using "find"
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
тАО05-08-2008 01:05 AM
тАО05-08-2008 01:05 AM
How to exclude a directory using "find"
This command finds all the tar files
#find / -name '*.tar' -mtime -1
I've been trying to modify it to exclude /share01 but need help.
I've tried this next command but it doesnt exclude /share01:
#find / -name '*.tar' -mtime -1 ! -path "/share01/*"
Any tips?
- Tags:
- find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-08-2008 01:31 AM
тАО05-08-2008 01:31 AM
Re: How to exclude a directory using "find"
see this similar thread
http://forums11.itrc.hp.com/service/forums/questionanswer.do?admit=109447626+1210238978644+28353475&threadId=1212067
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-08-2008 01:39 AM
тАО05-08-2008 01:39 AM
Re: How to exclude a directory using "find"
Ive been looking at similiar threads but cannot get the correct syntax.
I tried the following but no joy
find / -name '*.tar' -path /share01 -prune
Any ideas?
- Tags:
- -prune
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-08-2008 01:46 AM
тАО05-08-2008 01:46 AM
Re: How to exclude a directory using "find"
So, lets try this command
#find / -type d \( -name DIR1 -o -name DIR2 -o -name DIR3 \) -prune -o
-type d -print
Have fun!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-08-2008 03:38 AM
тАО05-08-2008 03:38 AM
Re: How to exclude a directory using "find"
The /share01 directory is a remotely mounted NFS directory so I just told it to search local directories instead.
#find / ! -local -prune -o -name '*.tar' -mtime -1 -print
It's a work-around but im pleased.
thanks for your assistance ahsan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-09-2008 05:25 AM
тАО05-09-2008 05:25 AM
Re: How to exclude a directory using "find"
LIST=`find / yadda yadda | grep -Ev "^\/excludedir"`
for X in $LIST
do
commands
commands
done
steve