Link to home
Start Free TrialLog in
Avatar of BeginToLearn
BeginToLearn

asked on

"." and ".."

Hi,
 I need explanation of "." and ".." value in d_name of struct direct when reading directory in Linux . Thanks a lot.
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

"." refers to the current directory itself,
".." refers to the parent directory
Avatar of BeginToLearn
BeginToLearn

ASKER

about DT_DIR? could you explan this
 
 if ( DT_DIR & pEntry->d_type && strcmp ( pEntry->d_name, ".") && strcmp ( pEntry->d_name, ".."))

 tks.
this condition checks IF the pEntry->d_name value is either "." or ".." , and if the p_entry.d_type is DT_DIR ...
presumable to exclude those from the processing ...
i now what it check. but i don't understand the meaning of "." and ".." in this case which is reading directory. thanks.
i mean relate to

"." refers to the current directory itself,
".." refers to the parent directory

can u give example?
tks
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I understand "." now. It tell where the "dir " command is issued. But why do we need ".."?
any when a program copy a directory ( and its suddirectory ) to another place, do we need to skip "." and ".."? tks.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
tks all. I get it now.