To create a directory in C#, all you need is one line. Because the method CreateDirectory will create directories or folders, all the way down the tree. So this means that you don’t need to make any if statments to check if the directory exists. The method CreateDirectory will do that for you.
Using the method CreateDirectory is the best and fastest way to create folders/directories in C# and is widely used in my projects.
Check this post if you need to create a file in C#: https://www.jennerstrand.se/create-file-in-c/
Or look at this post to write lines to a text file: https://www.jennerstrand.se/write-lines-to-a-text-file-in-c-sharp/
Source on directory/folders from Microsoft: https://docs.microsoft.com/en-us/dotnet/api/system.io.directory?view=net-5.0
Check out these simple easy to read articles about add object to List, reverse for loops and for loops if you want som extra reading: