-
October 16th, 2006, 02:04 AM
#1
What is "." & ".." - files? folders?
When i search for files using winapi, i usually come across 2 files/folders. (Am calling them files/folders since i get them as a result when i search for files.)
What are these exactly?
I tried google but...
C++ program ran... C++ program crashed... C++ programmer quit !!
Regards
Shaq
-
October 16th, 2006, 02:09 AM
#2
Re: What is "." & ".." - files? folders?
. stands for the current folder
.. for the parent folder
If you launch a command prompt and do a dir, you would see the same
-
October 16th, 2006, 02:10 AM
#3
Re: What is "." & ".." - files? folders?
It are folders. They represent the current folder '.' and the parent folder '..'
-
October 16th, 2006, 03:42 AM
#4
Re: What is "." & ".." - files? folders?
Did you never typed in a console:
?
-
October 16th, 2006, 03:47 AM
#5
Re: What is "." & ".." - files? folders?
Originally Posted by kirants
. stands for the current folder
.. for the parent folder
If you launch a command prompt and do a dir, you would see the same
Thanks.
what is the use of this?
and..I dont get something,
what is the use of the dot for current folder, when u r in the current folder.
Any links would be great.
C++ program ran... C++ program crashed... C++ programmer quit !!
Regards
Shaq
-
October 16th, 2006, 03:48 AM
#6
Re: What is "." & ".." - files? folders?
Originally Posted by cilu
Did you never typed in a console:
?
Never wondered why, until now.
C++ program ran... C++ program crashed... C++ programmer quit !!
Regards
Shaq
-
October 17th, 2006, 12:50 AM
#7
Re: What is "." & ".." - files? folders?
Originally Posted by Vedam Shashank
what is the use of the dot for current folder, when u r in the current folder.
Good question and I don't know why
Seems to be some kind of DOS legacy thing.
-
October 17th, 2006, 01:59 AM
#8
Re: What is "." & ".." - files? folders?
Originally Posted by kirants
Good question and I don't know why
Seems to be some kind of DOS legacy thing.
I think it's rather Unix related.
http://en.wikipedia.org/wiki/Path_(computing)
-
October 17th, 2006, 02:09 AM
#9
Re: What is "." & ".." - files? folders?
Originally Posted by Vedam Shashank
Thanks.
what is the use of this?
and..I dont get something,
what is the use of the dot for current folder, when u r in the current folder.
Any links would be great.
The use is obvious, you dont need to type specific name to access current or parent folder, using dot(s) make it generic.
Regards,
Ramkrishna Pawar
-
October 17th, 2006, 02:59 AM
#10
Re: What is "." & ".." - files? folders?
Originally Posted by Vedam Shashank
Thanks.
what is the use of this?
and..I dont get something,
what is the use of the dot for current folder, when u r in the current folder.
Any links would be great.
I could be useful if you want to list all the folders which can be reached form a certain location.
If your current location is C:\MyFolder\ then you could list all the reachable folders as
C:\MyFolder\.\
C:\MyFolder\..\
C:\MyFolder\FirstSubfolder\
C:\MyFolder\SecondSubfolder\
etc.
But I agree it seems a bit redundant.
-
October 17th, 2006, 03:07 AM
#11
Re: What is "." & ".." - files? folders?
"." can be used as a shorthand for many commands. for example the subst command
will mount the current directory as a drive ( z: ). You need not type the entire path to accomplish this. Though this existed from DOS(AFAIK), they are quite handy and are kept around. Depending upon the directory/file structure the ".." may point back to the parent directory. This way file recovery softwares can identify and/or resolve conflicts in folders if some corruption occurs to the directory/ file structure.
Last edited by kumaresh_ana; October 17th, 2006 at 03:10 AM.
-
October 17th, 2006, 05:06 AM
#12
Re: What is "." & ".." - files? folders?
Hi,
It is certainly unix or linux related. (..) and (.) came from unix. In DOS (..) makes sense but not (.). but in unix to execute a executable(!!) you need to specify the path.Unlike DOS Even the Current directly should be explicitly mentioned.
For example.. Many would know to execute a C program in linux or unix after compiling you need to type .\a.out.
.\a.out ==> CURRENTDIRECTORY\a.out
bye
P.Somasundaram
-
October 17th, 2006, 07:11 AM
#13
Re: What is "." & ".." - files? folders?
The reason for this is (among other things) that some systems were compromized by changing the PATH variable. In unix PATH may have priority over the current directory.
So, if PATH points to a directory that contains a malicious executable file with the same name as a file in the current directory, typing "myexe" would excute that malicious file while "./myexe" would execute the file in the current directory.
Nobody cares how it works as long as it works
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|