I use a FileUploader control in my application. I want to save a file in a specified folder. Now I want, if this folder does not exist, to first create it, and then save my file to this folder. If the folder already exists, then just save the file in it.
How I can do this?
As others have said, use
But, you don't need to check if it exists first. From the docs
Any and all directories specified in path are created, unless they already exist or unless some part of path is invalid. The path parameter specifies a directory path, not a file path. If the directory already exists, this method does nothing.