0

In a relative path, what's the difference between ~/directory/subdirectory and ./directory/subdirectory?

4
  • what platform and/or language are you referring too? Commented Sep 1, 2010 at 15:20
  • Does ~/ work in Windows? Are you using Cygwin? (not mentioning the /...) Commented Sep 1, 2010 at 15:25
  • @ring0 IIRC, I think some (most?) path-related Java libraries allow you to use forward slashes for paths on both Linux/Windows - the libraries convert them for you using File.seperator. IIRC, that is. Commented Sep 1, 2010 at 15:27
  • ~ doesnot work in Windows, it must be Unix/Linux or some Unix/Linux simulator environment. And how is this related to Java. You should change the tags to Unix rather than java. Commented Sep 1, 2010 at 15:32

2 Answers 2

6

In Linux, ~ is your home directory, while . is the current directory, so those pathes are the same when you are in your home directory (since . is ~), but not in other cases.

~/directory/subdirectory refers to subdirectory folder inside directory folder, inside your home folder.

./directory/subdirectory refers to subdirectory folder inside directory folder, inside current execution folder.

Sign up to request clarification or add additional context in comments.

Comments

0

~/directory/subdirectory for any particular user, is an absolute path instead. It referes to "directory/subdirectory" inside the user's home directory.

./directory/subdirectory is a relative path. It referes to "directory/subdirectory" inside the current directory (output of pwd command).

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.