Ok, so I already have a small console program written (full code can be seen here) for this task. Basically, what it does, is the user grabs a CSV that is full of filenames, then chooses where to save them, and the program then runs through and creates a file based on each string in the CSV. What I have already is this:
// "newFiles" is a list of all the filenames taken from the CSV
foreach (string s in newFiles)
{
try
{
StreamWriter sw;
// eg. filename = "C:\\FolderName\\Filename.pdf"
string fileName = folderName + "\\" + s;
sw = File.CreateText(fileName);
sw.WriteLine("Place holder file for Hard Copy entry");
sw.Close();
}
catch (Exception e) { Console.WriteLine("File not created - " + e.Message); }
}
However, the problem is that the file name (s
) is a full file name, including the extension. So in the case of files such as a .pdf, this process does not create them in the correct format. This essentially just creates a .txt file, and changes the extension. Therefore, this cannot even be opened.
If I can instead create a .pdf file that is in the correct format, I can use that file without having to replace it due to it being in the wrong format.
I was instead thinking of perhaps doing an "open - create new - save as" procedure instead, but I am not entirely sure of how I should be doing this.