Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
Hi Friends,
 
Well Friends, I working on a Project called "Computer Scanner" And till now i m done with the scanning code for a Particular Folders and Directories and now i wants to implement some code which will help me to scan entire Hard Drives, like C drives along with the following Folders.
 
Plz Guys Help me....
 
thanks in Andvance. Smile | :)
Posted 23-Nov-12 22:18pm
Edited 24-Nov-12 2:47am
v2
Comments
Abhishek Pant at 24-Nov-12 3:41am
   
Richard MacCutchan at 24-Nov-12 4:50am
   
Do you mean scan all directories starting at the root (e.g. C:\), or scanning at the hardware level?
Nikhil@123 at 24-Nov-12 7:19am
   
Yes you are Right Sir!
Richard MacCutchan at 24-Nov-12 8:15am
   
What do you mean I am right? I asked you which type of scanning you want to do.
Nikhil@123 at 24-Nov-12 9:26am
   
Sir,
 
Sir i am working on a project called "Computer Scanner", so now i have implemented code for scanning a particular files or folders in drives. And now i
I wants my application to Scan the entire C:// and if it finds file or folders inside C:// it should scan that files and folders as well.
this is what i wants to implement in my application.
Plz help Sir!
Richard MacCutchan at 24-Nov-12 10:21am
   
Well if you can start from a specific folder (directory) then you can start from the root of any drive. I don;t understand what your problem is.
Nikhil@123 at 25-Nov-12 0:29am
   
How to Scan Full Drive in c#, Full Drive means(c://Folders/Files with contents.
I hope u have understood..
Richard MacCutchan at 25-Nov-12 3:07am
   
I already told you, you can start your scan from anywhere: C:\, C:\Windows, C:\Folderx etc. What part of this do you not understand?
Nikhil@123 at 25-Nov-12 23:31pm
   
Sir,
 
When i give a particular path like C:\\ then Scanning code scan only the Folder which is stored under C:\\ and when its finds another folder inside the folder its does not scan folders inside the folders, so i wants to implement some code where it should scan folders and when it finds another folder or files inside that Folder it should scan that as well.
For Example,
 
Root : C:\\
Folders 1 : Scanned.
Folders 2 (inside folder 1) : UnScanned.
Folders 3 (inside folder 2) : UnScanned.
 
So here i wants to implement some code where it should scan folders inside the folders.
I hope you have understood.
 

Thanks in Advance :)
Richard MacCutchan at 26-Nov-12 3:48am
   
Then you need to add some code to check each entry and if it's a folder to either save it for later or start a scan of the folder, and so on. Many implementations of this type of functionality would just use recursive calls into a function that takes a path name to scan. Then when the scan finds a folder it adds that folder name to the current path and calls itself with the new pathname. This will then continue until all folders have been scanned.
OriginalGriff at 24-Nov-12 7:55am
   
Don't bump your question.
By all means add new information, but just bumping it is rude and counter productive.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You should start from root directory (e.g. C:\) and then proceed recursively.
Directory Class[^] provides methods for enumerating files and sub-directories.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

There is a Class Called SearchOption.AllDirectories();
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 7,105
1 DamithSL 5,079
2 Maciej Los 4,866
3 Sergey Alexandrovich Kryukov 4,617
4 Kornfeld Eliyahu Peter 4,384


Advertise | Privacy | Mobile
Web02 | 2.8.141223.1 | Last Updated 26 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100