Home Man
Search
Today's Posts
Register

If you're not sure where to post a Unix or Linux question, post it here. All unix and Linux beginners welcome in this forum!

How to find and get a file in an entire directory with an excluded directory specified?

Login to Reply

 
Thread Tools Search this Thread
# 1  
Old 02-28-2018
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 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
# 2  
Old 03-01-2018
-o -print will print all files regardless of the tests executed before.
# 3  
Old 03-22-2018
If -prune doesn't work for you, this will:
Moderator's Comments:
How to find and get a file in an entire directory with an excluded directory specified? Please use code html tags


Code:
find -name "*.js" -not -path "./directory/*"

---------- Post updated at 05:13 AM ---------- Previous update was at 05:12 AM ----------

Code:
find . -name '*.js' -and -not -path directory

---------- Post updated at 05:14 AM ---------- Previous update was at 05:13 AM ----------

This is the format I used to exclude some paths:

Code:
$ find ./ -type f -name "pattern" ! -path "excluded path" ! -path "excluded path"

I used this to find all files not in ".*" paths:

Code:
$ find ./ -type f -name "*" ! -path "./.*" ! -path "./*/.*"


Last edited by jim mcnamara; 03-22-2018 at 08:24 AM..
Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Append two lines of text to php.ini in the entire directory tree.e Larrykh465 UNIX for Dummies Questions & Answers 6 09-05-2015 04:21 PM
Find every directory named XYZ under the DVLP directory emc^24sho Shell Programming and Scripting 7 10-16-2013 01:53 PM
Looping through entire directory and count unique values ritakadm Shell Programming and Scripting 1 07-23-2013 12:31 AM
Using restorevgfiles to restore entire directory from rootvg problems herot AIX 10 08-28-2012 03:28 PM
cannot find file directory Ericyue UNIX for Dummies Questions & Answers 1 04-05-2012 01:12 AM
Find file directory magesh_bala Shell Programming and Scripting 8 10-27-2010 04:07 PM
tar the entire directory except one directory kalpeer Shell Programming and Scripting 4 09-02-2009 05:22 AM
how to zip the entire directory bbc17484 UNIX for Dummies Questions & Answers 3 06-16-2009 07:25 AM
Script to find a string in a directory/sub-directory gross UNIX for Dummies Questions & Answers 3 11-13-2008 03:45 PM
how to find a file named vijay in a directory using find command amirthraj_12 UNIX for Dummies Questions & Answers 6 10-25-2008 12:37 PM


All times are GMT -4. The time now is 05:05 PM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password