Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does @"../.." mean in a path?

I am following this tutorial from MSDN.

There's something I saw in the code that I can't understand

    private void PopulateTreeView()
    {
        TreeNode rootNode;

        DirectoryInfo info = new DirectoryInfo(@"../.."); // <- What does @"../.." mean?
        if (info.Exists)
        {
            rootNode = new TreeNode(info.Name);
            rootNode.Tag = info;
            GetDirectories(info.GetDirectories(), rootNode);
            treeView1.Nodes.Add(rootNode);
        }
    }
like image 208
Xel Avatar asked Feb 22 '12 04:02

Xel


People also ask

What does \\ mean in path?

. means it's the current directory. / is normally used in paths to show the structure of files and folders. \\ is referring to \ (used double because \ is a special character) which is same as / but used differently depending on the OS.

What does double dot mean in file path?

A relative path refers to a location that is relative to a current directory. Relative paths make use of two special symbols, a dot (.) and a double-dot (..), which translate into the current directory and the parent directory. Double dots are used for moving up in the hierarchy.

What does double asterisk mean in path?

The double asterisks are placeholders or instructions to the recursive interpreter to go through the files and folders. It is a simple, recursive wildcard while only one asterisk means all without recursion.

What is in a file path?

A standard DOS path can consist of three components: A volume or drive letter followed by the volume separator ( : ). A directory name. The directory separator character separates subdirectories within the nested directory hierarchy.


2 Answers

@ is for verbatim string, so that the string is treated as is. Especially useful for paths that have a \ which might be treated as escape characters ( like \n)

../.. is relative path, in this case, two levels up. .. represents parent of current directory and so on.

like image 90
manojlds Avatar answered Oct 20 '22 11:10

manojlds


.. is the container directory. So ../.. means "up" twice.
For example if your current directory is C:/projects/a/b/c then ../.. will be C:/projects/a

like image 42
shift66 Avatar answered Oct 20 '22 12:10

shift66