Swaps the current working directory with a new directory, optionally moving or deleting the files in the original directory.
This example demonstrates how to swap to a new working directory while moving all files from the old directory to the new one.
var directoryManager = new DirectoryManager();
string currentPath = directoryManager.CurrentPath;
string newPath = @"C:\NewDirectory";
directoryManager.Swap(newPath, SwapDirectoryOptions.Copy);
Console.WriteLine($"Directory swapped from {currentPath} to {newPath}, with all files moved.");
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2