First of all, it's just dawned on me that you'll need to create the directory before you can save any files to it. So, I'd change the above method to get the full directory path:
string GetDirectoryPath(string customerNumber, string typeOfDocument)
{
string staticPath = "D:/app1/test";
string date = DateTime.Today.ToString("MM-dd-yyyy");
return String.Format("{0}/{1}/{2}/{3}/", staticPath, date, customerNumber, typeOfDocument);
}
You can then use System.IO.Directory.CreateDirectory(dirPath) to create it.
If you want to create a file (say scampercat.txt) in that directory, the file path will of course be:
string filePath = dirPath + "/" + "scampercat.txt";
Suppose you have an array containing three lines that you'd like to write to the file:
string[] array = {"First line", "Second line", "Third line"};
You can then create the file and write those lines to it with:
System.IO.File.WriteAllLines(filePath, array);
Alternatively, you can do the same thing with a StreamWriter:
StreamWriter sw = new StreamWriter(filePath);
foreach(string line in array) sw.WriteLine(line);
sw.Close();
If you have an existing file that you'd like to move to the new directory, then you can use the System.IO.File.Move method:
http://msdn.microsoft.com/en-us/library/system.io.file.move.aspx