0

I am trying to fetch one file from two different paths.I used below command, seems execution fine but there is no output.

find . \( -path "/usr/local" -o -path "/user/local/archive" \) -name "xyz.csv"

Could you please help me on this?

1 Answers1

3

The reasons you don't get output:

  • The dot . is the root of your search, so if your are not in the root directory, you won't have /usr/local in your search tree
  • The -path option has to match the whole path, including the object to find, so if you have given a -name this name needs to be part of the -path, too (or be globbed with * at the end)

But find takes more than one argument as search path, so you can search like @Kamaraj wrote in his comment. In your case this is not even neccessary, as find also searches in subdirectories, thus find /usr/local -type f -name xyz.csv will also find /usr/local/archiv/xyz.csv

Philippos
  • 13,237
  • 2
  • 37
  • 76