Reputation: 1423
I am using find command to create a list of files that I want to use for distribution bundle. but find is not able to get the list of all files
Below is my directory structure
.
├── 1.cpp
├── test
│ └── 1.cpp
└── test1
├── 1.cpp
└── test11
├── 1.h
└── 2.cpp
below is the command and its output ( note: it does not bring the ./test1/test11/2.cpp)
$ find . -name *.cpp
./test/1.cpp
./1.cpp
./test1/1.cpp
however when i am using the specific name it is able to locate the file
$ find . -name 2.cpp
./test1/test11/2.cpp
Upvotes: 0
Views: 49
Reputation: 19305
it's because *.cpp
is expanded to 1.cpp
because there is a match in current directory use quotes "*.cpp"
or escape star \*.cpp
to avoid expansion and pass star literaly as argument for find.
Upvotes: 1