Użytkownik "Greg Smith" <gj*@umn.edu> napisał w wiadomości
news:%2****************@tk2msftngp13.phx.gbl...
Hi, all.
I have been asked to write an application that would keep track on archive
data on CDs and DVDs. I will basically need a line for each file.
I have started out by saving a "dir" to a text file and parsing the file,
but it seems there must be a better way to do this.
Is there a way to read down a directory tree and get all the folder and
file information?
If you want to scan disk recursive, you can use that code:
---
public void ProcessDir(string sourceDir, int recursionLvl)
{
string [] fileEntries = Directory.GetFiles(sourceDir);
foreach(string fileName in fileEntries)
fileList.Items.Add (fileName ,CheckState.Checked);
string [] subdirEntries = Directory.GetDirectories(sourceDir);
foreach(string subdir in subdirEntries)
if ((File.GetAttributes(subdir) &
FileAttributes.ReparsePoint)!=FileAttributes.Repar sePoint)
ProcessDir(subdir,recursionLvl+1);
}
---
this works with checkbox list, but of course you can change it, and save to
xml or sth.
Inez Korczyński