Whats the easiest way to ensure folder exist before I do a File.Move?

Viewed 22634

I have a folder structure:

C:\Temp [completely empty]

And I have a file that I want to move to

C:\Temp\Folder1\MyFile.txt

If I perform a File.Move I will get an error saying that this folder doesnt exist.

Is there any C# method that will create all the folders up to that point so:

C:\Temp\Folder1\

?

3 Answers
Related