Click here to Skip to main content
16,020,673 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I want to scan a Directory for checking each file/folder in it, getting its name with extension, size, check whether its a file or folder. Is there any WINDOWS class available to do these operation or Can anybody suggest me the code for it?
Thanking u in advance.....
Posted

You may use, recursing into directories, the technique show in this MSDN example: "Listing the Files in a Directory"[^].
 
Share this answer
 
Comments
MartinTaylor 18-Mar-11 17:50pm    
Thank you..I'll check it...
Hi,
If you use MFC, you can benefit from CFileFind[^] class.
Otherwise, you can use these functions FindFirstFile(...)[^], FindNextFile(...)[^], FindFirstFileEx(...)[^] and FindClose(...)[^]
 
Share this answer
 
Comments
MartinTaylor 18-Mar-11 17:45pm    
The reason I dont want to use MFC classes is that latter i want to integrate this code in Windows Form Application & I read somewhere that you can not use MFC classes with windows header files/Applications..Is that true?
Ozer Karaagac 18-Mar-11 17:52pm    
I don't exactly know but I don't think so. If you don't want to use MFC, CPallini's solution is right for you. You may want to add it recursion and skipping '.' dirs.

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