Today I am going to share one of the best concepts that I learned about Absolute and Relative Pathnames. Sometimes when I used to write programs, I had to provide the path of the files and I used to have a lot of trouble.
An absolute path starts from the location of the root directory, in the above example, the root directory is “C” drive followed by “\” (backward slash). The relative path only contains the name of the folder or files inside the current working directory, like in the above example the relative path is “shivam kumar”.
Suppose, if you are in a directory that doesn’t contain the “shivam kumar” folder or file whatever it is then you will get an error message. So, in this case, you need to provide the full path of that particular file.
How to get Absolute Path?
Right click on any folder > click on “Properties” > Check the “location”
“C:\Users\shivam kumar\Desktop\screen shots” is the absolute path of the particular folder.
Also Read: How to add path in Window 10?
What is . and .. folders? How to use it
In the process of providing the paths, “.” refers to the working folder(or working directory), and “..” refers to the parent directory. And the most important thing is both “.” and “..” is used for relative path and NOT for absolute paths.
In the above figure, you can see that I have given a directory tree and written both Absolute and Relative Pathnames for every file and folder. I hope it will be helpful for understanding the basic concepts of the path of every directory in our computer system.
You can also read:
- What is a google people card?
- 4 Important tips to increase typing speed.
- Best free tools for compressing and resizing images.
Thank you very much for reading this article. If you have any suggestions regarding this, please write in the comment box. I would love to hear you.