find command and reading from a file

General support questions
Post Reply
csptra
Posts: 22
Joined: 2016/12/19 19:57:18

find command and reading from a file

Post by csptra » 2018/06/05 18:07:34

Hello Everyone,

I've been experimenting with find, and searching some with google and I've found/figured out how to exclude a directory from the search results. However, I would like the to read the directory exclusion list from a file. Something like the following (though, I know this won't work):

find /dir -name filename -not -perm octet ! -path <contents of file containing paths> -exec some_command


everything works fine if I just put the path directly inline like below:

find /dir -name filename -not -perm octet ! -path "/dir/directory/*" -exec some_command

I'm not adept (yet) at scripting and probably am overlooking something obvious. I believe I could write a multiple line script to do this, but was wanting a one liner if possible. :)

Thanks.

Post Reply