when we specify the file path some times we specify like ./filename and some time ../filename what is difference between these two?

| improve this question | | | | |

../ refers to the parent folder while ./ means the current folder

| improve this answer | | | | |
  • 1
    they are just a shortcut, so you dont have to write out long directory names. – Keltari Aug 25 '11 at 2:41

. means 'the current folder'.
.. means 'the folder containing the current folder'.

| improve this answer | | | | |

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"

| improve this answer | | | | |

Both are different. ./filename points to a file in current directory while ../filename points to a file in parent directory

| improve this answer | | | | |

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.


  • image in current folder: "./profile1.jpg";
  • image in parent folder: "../Images/profile1.jpg:"
| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy