LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-28-2018, 09:52 PM   #1
BudiKusasi
Member
 
Registered: Apr 2017
Distribution: Artix
Posts: 345

Rep: Reputation: 15
How to find and get a file in an entire directory with an excluded directory specified


How to get a file 'zlib.h' in an entire directory with an excluded directory specified which lives under that starting directory by using find command, as it failed on:

Code:
$  find . -name 'zlib.h' -a -ipath 'CHROME.TMP' -prune -o -print
it'll just list entirely up
 
Old 03-01-2018, 12:37 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
see man find, and check all the options you specified. How should one use them, why are they there (in your command)?
 
Old 03-01-2018, 03:54 AM   #3
Stéphane Ascoët
Member
 
Registered: Feb 2004
Location: Fleury-les-Aubrais, 120 km south of Paris
Distribution: Devuan, Debian, Mandrake, Freeduc (the one I used to work on), Slackware, MacOS X
Posts: 251

Rep: Reputation: 49
I don't understand the situation, could you explain it better?
 
Old 03-01-2018, 04:13 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Use locate.

KISS.
 
Old 03-01-2018, 06:30 AM   #5
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,309
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
Perhaps you meant like this?

Code:
find . -ipath '*CHROME.TMP' -prune -o -name 'zlib.h' -print
The -ipath option matches the whole path, so you might need an asterisk to match an arbitrarily long beginning to the path name. After that it is a matter of remembering the precedence in boolean logic, specifically OR versus AND. You can leave out the -a options because if there is no -o then -a is assumed.
 
1 members found this post helpful.
Old 03-01-2018, 09:29 AM   #6
BudiKusasi
Member
 
Registered: Apr 2017
Distribution: Artix
Posts: 345

Original Poster
Rep: Reputation: 15
EXCELLENT ! That's what is the eternal virtue out of sincere help.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
find the largest and smallest file in a directory and sub directory schandran Programming 5 05-06-2015 09:53 AM
Find largest file within a directory grob115 Programming 5 09-04-2011 02:35 AM
Find directory older than x and mv directory with sub files command ajhart Linux - Newbie 4 07-15-2011 05:24 AM
zip -x for a directory - Subfolder contents not being excluded recursively? SirTristan Linux - Newbie 4 12-10-2010 03:52 AM
accidentally moved entire linux root "/ " file system to another directory bks2010 Linux - Newbie 8 09-19-2010 05:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration