Hi, is this what you want, I threw it together real quick, but you should be able to finish the rest, this will get you started.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace filetest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
scanDir("C:\\", 1);
}
const int HowDeepToScan = 7;
private static void prcoessdire(string sourceDir, int recursionLvl)
{
scanDir(sourceDir, recursionLvl);
}
private static void scanDir(string sourceDir, int recursionLvl)
{
if (recursionLvl <= HowDeepToScan)
{
// Process the list of files found in the directory.
string[] fileEntries = Directory.GetFiles(sourceDir);
foreach (string fileName in fileEntries)
{
MessageBox.Show(fileName);
}
// Recurse into subdirectories of this directory.
string[] subdirEntries = Directory.GetDirectories(sourceDir);
foreach (string subdir in subdirEntries)
// Do not iterate through reparse points
if ((File.GetAttributes(subdir) &
FileAttributes.ReparsePoint) !=
FileAttributes.ReparsePoint)
scanDir(subdir, recursionLvl + 1);
}
}
}
}
This is just the basic concet of it....
tayspen
<Insert title here>
1,622 posts since Jul 2005
Reputation Points: 84
Solved Threads: 99