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. – Veno Mar 03 '23 at 06:50readlinkis 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)realpathis 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) – michael Jan 20 '24 at 02:50