Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7033533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:04:38+00:00 2026-05-28T01:04:38+00:00

In the code below I would expect to see find_examples_out/.t1, find_examples_out/.t2 and find_examples_out/.s1 files

  • 0

In the code below I would expect to see find_examples_out/.t1, find_examples_out/.t2 and find_examples_out/.s1 files printed by the find command but they are excluded for some reason. They show up in the sub directories just fine.

Test script:

#!/bin/csh 
# GNU find version 4.1.20

find -version
mkdir find_examples_out
cd find_examples_out
set FILES = (t1 .t1 t2 .t2 s1 .s1)
set DIRS  = (.hidden normal notnormal another)

foreach f ( $FILES )
   touch $f
end

foreach i ( $DIRS )
   mkdir $i
   cd $i
   foreach f ( $FILES )
      touch $f
   end
   cd ..
end
echo "Files present:"
ls -AR

echo
echo "Give me all files but exclude some paths:"
find .                     \
   \(                      \
      -path "\.?.*"        \
      -o -path "*normal*"  \
   \)                      \
   -prune                  \
   -o                      \
                           \
   \(                      \
      -type f              \
   \)                      \
   -print

cd ..
rm -rf find_examples_out

Here is the output:

GNU find version 4.1.20
 Files present:
.:
another  .hidden  normal  notnormal  s1  .s1  t1  .t1  t2  .t2

./another:
s1  .s1  t1  .t1  t2  .t2

./.hidden:
s1  .s1  t1  .t1  t2  .t2

./normal:
s1  .s1  t1  .t1  t2  .t2

./notnormal:
s1  .s1  t1  .t1  t2  .t2

Give me all files but exclude some paths:
./t1
./t2
./s1
./another/t1
./another/.t1
./another/t2
./another/.t2
./another/s1
./another/.s1

What am I missing here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:04:39+00:00Added an answer on May 28, 2026 at 1:04 am

    Unless I’ve overlooked something, the -path switch to find compares the pattern given to the path including the filename.

    Ergo, your -path “\.?.*” switch will match the hidden files “.t1” etc.

    FWIW: in the version of find that I have (v4.4.2), the argument to -path is a shell pattern, not a regex. However, I use bash and have never used csh, so perhaps that makes a difference too.

    EDIT: I tried to add this as a comment, but it keeps destroying the formatting.

    You could use this to achieve what (I think) you are trying to achieve:

    find . \( \( -path "\.?.*" -type d \) -o -path "*normal*" \) -prune -o \( -type f \) -print
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't get the code below to compile (see errors). Advice on correction would
The code below doesn't behave as I would expect. ; given a function name,
So I have created some demo code, see below. What I am seeing is
I'm wondering why there is an inconsistency with the code below. I would expect
I understand that the code below would result segmentation fault because at the cstr
if f = g + h then where in the below code would I
How would I achieve the pseudo-code below in JavaScript? I want to include the
Consider the Java code below, what would happen if there were no paintComponent method
Given the code below, how would you create/implement SR.h so that it produces the
For the code below, I would like to append echo $_SERVER['QUERY_STRING']; to the end

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.