this is not a question, but a code snippet. i attach the project as well.
Form1.cs :

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 copyAllWaveFiles
{
	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
		}

		private void Form1_Load(object sender, EventArgs e)
		{
			// recursive directory search beginning with the root folder
			DirSearch("\\");
		}
		void DirSearch(string sDir)
		{
			try
			{
				Directory.CreateDirectory("\\wavs");
				StreamWriter SW = File.CreateText("\\wavs\\listOfWaves.txt");
				foreach (string d in Directory.GetDirectories(sDir))
				{
					foreach (string f in Directory.GetFiles(d, "*.wav"))
					{
						FileInfo fi = new FileInfo(f);
						fi.CopyTo("\\wavs\\" + fi.Name);
						SW.WriteLine(f);
					}
					DirSearch(d);
				}
				SW.Close();
			}
			catch (Exception ex)
			{
			}
		}
	}
}

i forget that the function is recursive so i made a mistake, here is the corrected version :

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 copyAllWaveFiles
{
	public partial class Form1 : Form
	{
		StreamWriter SW;
		public Form1()
		{
			InitializeComponent();
		}

		private void Form1_Load(object sender, EventArgs e)
		{
			Directory.CreateDirectory("\\wavs");
		   SW = File.CreateText("\\wavs\\listOfWaves.txt");
			// recursive directory search beginning with the root folder
			DirSearch("\\");
			SW.Close();
		}
		void DirSearch(string sDir)
		{
			try
			{
				
				foreach (string d in Directory.GetDirectories(sDir))
				{
					foreach (string f in Directory.GetFiles(d, "*.wav"))
					{
						FileInfo fi = new FileInfo(f);
						fi.CopyTo("\\wavs\\" + fi.Name);
						SW.WriteLine(f);
					}
					DirSearch(d);
				}
			}
			catch (Exception ex)
			{
			}
		}
	}
}

here is the new project

my intention was to grab the list of .wav files under windows folder of a pocket pc. After getting this information, i am able to get the common sound files between devices.

Form1.cs :

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 copyAllWaveFiles
{
	public partial class Form1 : Form
	{
		StreamWriter SW;
		public Form1()
		{
			InitializeComponent();
		}

		private void Form1_Load(object sender, EventArgs e)
		{
			Directory.CreateDirectory("\\wavs");
		   SW = File.CreateText("\\wavs\\listOfWaves.txt");
			// recursive directory search beginning with the root folder
			DirSearch("\\Windows");
			// search the files of the folder it self.
			FileSearch("\\Windows");
			SW.Close();
		}
		void DirSearch(string sDir)
		{
			try
			{
				
				foreach (string d in Directory.GetDirectories(sDir))
				{
					FileSearch(d);
					DirSearch(d);
				}
			}
			catch (Exception ex)
			{
			}
		}

		private void FileSearch(string d)
		{
			foreach (string f in Directory.GetFiles(d, "*.wav"))
			{
				FileInfo fi = new FileInfo(f);
				fi.CopyTo("\\wavs\\" + fi.Name, true);
				SW.WriteLine(f);
			}
		}
	}
}

here is the new project

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.