Click here to Skip to main content
15,902,635 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Directory & file.
what is the difference between directory and file? ;
what does directory do? ;
why do we use directory? ;
what makes directory class special? ;
is there any other way to do what directory class does without using it? ;
what are abilities of directory? ;
Posted
Comments
Prosan 16-Jun-12 3:56am    
are you preparing for interview.

1 solution

The Directory and File objects are different because the targets they describe are different. A Directory refers to a disk directory (or similar) which contains a collection of Files.

If you like, think of a Directory as a special type of file which tells you where to go to get to each file. It's wrong in many ways, but it may help you to think about the structures a little better.

So a Directory object does directory related things, like listing the files in it, while a File object does file related things, like listing the file attributes, the size, and so forth.

For more detail, see the Directory class[^] and File class[^], both on MSDN
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900