Windows – What are “.” and “..” in a directory?

Based on the question: How to make using command prompt less painful, what are the . and .. entries in the most voted answer? I see it when I do a dir command but it isn’t visible to the user in the form of a file.

In case you dont know what I mean here’s an example:

...Su.exeSup.txtSuperUser.COM

Solution:

The . is the current directory, while .. signifies the parent directory. It makes things quicker at the command line as well so you don’t need to type out full paths.

example:

go up 2 directories:

cd ....

or on a UNIX based system, to run executable binaries in the current directory:

./program

A lot of UNIX scripts will also utilize . to represent the current directory, in order to scan for files for example (Perl):

#!/usr/bin/perlopendir ( DIR, "." ) || die "Error opening current directoryn";while( ($f = readdir(DIR))){     print("$fn");}closedir(DIR);

It is much more portable if you wish to move the script around to different directories or systems since a directory name is not hard-coded.