Guys, I need your help again in C#. I have a folder that contains txt files. I want to be able to convert the text to audio of any file in that folder. I know how to do the convestion but how to automatically convert whenever there is any new txt file in that folder. What I need is to be able to detect a new txt file and automate the conversion without the user opening the file manually.

Please take a look at FileSystemWatcher class. It should take care of your requirement.

Thanks, u have helped me.

Now my problem is: is there a way to save a file with a particular name without using the savefiledialog. U see I want to automate a save in my project. Whenever there is a new txt file in a folder being watched, i want to convert that file to audio and save the audio copy as mp3 automatically without the user doing the saving. Am able to convert the text to audio and save using savefiledialog but i want to automate it. Any help will be appreciated.

To automate it, you could create a new file at a specified location, then write the converted data to the new file.

if (!File.Exists(@"C:\convertedFile.mp3"))
	// File already exists, you have the option to delete this file and create the new converted file. (Uncomment next two lines)
	// File.Delete(@"C:\convertedFile.mp3");
	// File.Create(@"C:\convertedFile.mp3");
This article has been dead for over six months. Start a new discussion instead.