Is there a way to get absolute path of a file that is being searched?
For example:
find .. -name "filename"
It gives me results like ../filename
but I want the full path.
What I need is to find in the parent directory and its children, for a specific file, that I will use in another script later.
Thanks
find $(readlink -f ..) -name "filename"
. Use readlink in the file path for ease.readlink
is the best answer by far, but I'll just add that (1) quotes are important in case there's a space in the dir name, and (2)realpath
is apparently preferred according toman readlink(1)
: eg:find "$(realpath ..)" -name "filename"
(nb:find ... -printf ...
has no option for this, andfind ... - exec readlink -f {} \;
is suuuuper slow)