when we specify the file path some times we specify like ./filename and some time ../filename what is difference between these two?
Asked
Active
Viewed 1,088 times
12
Oliver Salzburg
- 87,539
- 63
- 263
- 308
5 Answers
22
../ refers to the parent folder while ./ means the current folder
Mathias Conradt
- 897
-
1they are just a shortcut, so you dont have to write out long directory names. – Keltari Aug 25 '11 at 02:41
8
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"
user46627
- 223
2
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:"
Burgi
- 6,551
Ishan Shah
- 283