I need to move all files from source folder to destination folder. How can I easily extract file name from file path name?
string newPath = \"C:\\\\NewPath\"
You can do it like this:
string newPath = "C:\\NewPath"; string[] filePaths = Directory.GetFiles(_configSection.ImportFilePath); foreach (string filePath in filePaths) { string newFilePath = Path.Combine(newPath, Path.GetFileName(filePath); File.Move(filePath, newFilePath); }