Let's say I have a file name defined as "..............\bin\prices.xls", is there a simple way to convert that to a fully qualified path (one that includes the Drive letter, colon and all folders to the file)?
The absolutePath function works by beginning at the starting folder and moving up one level for each "../" in the relative path. Then it concatenates the changed starting folder with the relative path to produce the equivalent absolute path.
Click the Start button and then click Computer, click to open the location of the desired file, hold down the Shift key and right-click the file. Copy As Path: Click this option to paste the full file path into a document. Properties: Click this option to immediately view the full file path (location).
A fully qualified path or absolute path always defines an exact path from a particular drive or device to a target file or directory, and does not depend on the current drive or current directory.
In simple words, an absolute path refers to the same location in a file system relative to the root directory, whereas a relative path points to a specific location in a file system relative to the current directory you are working on.
Try Path.GetFullPath():
Returns the absolute path for the specified path string.
The absolute path includes all information required to locate a file or directory on a system.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With