TheDarklord
March 5th, 2010, 03:14 PM
I have some code which search for mp3 files and extracts that information for each file in each folder in a directory.
private void ShowFiles_Click(object sender, EventArgs e)
{
foreach (string foldername in Directory.GetDirectories(DirectoryName))
{
MP3Header mp3hdr = new MP3Header();
string Mp3Filename;
foreach (string filename in Directory.GetFiles(foldername))
{
string extension = Path.GetExtension(filename);
FileInfo f = new FileInfo(filename);
if (extension == FileTypeExtension)
{
this.listBox1.Items.Add(filename);
}
if (f.Length <= thisFileLength)
{
this.listBox2.Items.Add(filename);
}
// Form1 tag = new Form1();
bool boolIsMP3 = mp3hdr.ReadMP3Information(filename);
this.listBoxFileName.Items.Add(mp3hdr.strFileName);
this.listBox3.Items.Add(mp3hdr.lngFileSize.ToString());
this.listBoxBitRate.Items.Add(mp3hdr.intBitRate.ToString());
this.listBoxFrequency.Items.Add(mp3hdr.intFrequency.ToString());
this.listBoxstrMode.Items.Add(mp3hdr.strMode);
this.listBoxstrLength.Items.Add(mp3hdr.strLengthFormatted);
Mp3Filename = filename;
}
What would be the best way to extend this code so that it can compare files in one folder to a file in another folder, so for a duplicate finder?
private void ShowFiles_Click(object sender, EventArgs e)
{
foreach (string foldername in Directory.GetDirectories(DirectoryName))
{
MP3Header mp3hdr = new MP3Header();
string Mp3Filename;
foreach (string filename in Directory.GetFiles(foldername))
{
string extension = Path.GetExtension(filename);
FileInfo f = new FileInfo(filename);
if (extension == FileTypeExtension)
{
this.listBox1.Items.Add(filename);
}
if (f.Length <= thisFileLength)
{
this.listBox2.Items.Add(filename);
}
// Form1 tag = new Form1();
bool boolIsMP3 = mp3hdr.ReadMP3Information(filename);
this.listBoxFileName.Items.Add(mp3hdr.strFileName);
this.listBox3.Items.Add(mp3hdr.lngFileSize.ToString());
this.listBoxBitRate.Items.Add(mp3hdr.intBitRate.ToString());
this.listBoxFrequency.Items.Add(mp3hdr.intFrequency.ToString());
this.listBoxstrMode.Items.Add(mp3hdr.strMode);
this.listBoxstrLength.Items.Add(mp3hdr.strLengthFormatted);
Mp3Filename = filename;
}
What would be the best way to extend this code so that it can compare files in one folder to a file in another folder, so for a duplicate finder?