Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find command to return absolute path

I'm using find command a lot on unix (csh).

Is it possible that the result will be full/absolute path and will start from the directory where I'm starting the search

for example when running command from /project/Test/v0.15/test/frontend, the results are:

./core/serdes_complex/frontend/lib/lib_behave.f
./core/serdes_complex/frontend/lib/test_srd_compile.f

But i would like to get

/project/Test/v0.15/test/frontend/core/serdes_complex/frontend/lib/lib_behave.f
/project/Test/v0.15/test/frontend/core/serdes_complex/frontend/lib/test_srd_compile.f
like image 221
Jonathan Avatar asked Jul 26 '15 11:07

Jonathan


3 Answers

I got it to work using $PWD:

find $PWD -name \*.f

like image 21
Eric Hanson Avatar answered Oct 11 '22 00:10

Eric Hanson


Try searching from $cwd:

find $cwd -name \*.f
like image 30
Nathan Fellman Avatar answered Oct 10 '22 23:10

Nathan Fellman


You should use the command realpath to resolve the path :

find . -name "*.f" -exec realpath {} \;
like image 169
mpromonet Avatar answered Oct 10 '22 23:10

mpromonet