What is the best way to move directory with all its contents(files or folders) in C#?
I used the following codes, but it throws The Directory is not empty
The Directory is not empty
You can try this
DirectoryInfo dir = new DirectoryInfo(source); dir.MoveTo(newLocation);