05-08-2024, 05:08 PM
I have been working on a batch script that needs to resolve the full path of a file for processing. Essentially, what I'm trying to achieve is for the command line to print the absolute path of a file given its relative path or filename. I've stumbled across several solutions that use different command-line utilities, but I haven't found one that fits my needs perfectly. For example, consider the file file.txt which is located in the directory /nfs/an/disks/jj/home/dir/. If I'm currently in the dir directory, I want to be able to issue a command like the following and have it return the file's full path:
And the output should be exactly:
Is there a robust and cross-platform approach to doing this? A snippet of code that can be used directly in my script would be ideal.
And the output should be exactly:
Is there a robust and cross-platform approach to doing this? A snippet of code that can be used directly in my script would be ideal.