when we specify the file path some times we specify like ./filename
and some time ../filename
what is difference between these two?
5 Answers
../
refers to the parent folder while ./
means the current folder
-
1they are just a shortcut, so you dont have to write out long directory names.– KeltariAug 25, 2011 at 2:41
.
means 'the current folder'.
..
means 'the folder containing the current folder'.
just in case you wonder, ./filename
actually means the same thing as filename
- however, on unix systems, the current path isn't searched for executables (for security reasons), so you have to explicitly say "look in the current directory"
Both are different. ./filename
points to a file in current directory while ../filename
points to a file in parent directory
Both ./
and ../
are the ways to describe a file-path. As all suggested above you can use ./
while your file is in the current folder and ../
while your specified file is in the parent directory. Generally, it is useful while your current folder and parent folder both contains the file with the same name. Then these are very helpful to get the exact file from the folder you have specified.
Ex.
- image in current folder: "./profile1.jpg";
- image in parent folder: "../Images/profile1.jpg:"