public static void Move(string sourceFilePath, string descDirectoryPath) { string sourceFileName = DirFileHelper.GetFileName(sourceFilePath); if (DirFileHelper.IsExistDirectory(descDirectoryPath)) { if (DirFileHelper.IsExistFile(descDirectoryPath + "\\" + sourceFileName)) { DirFileHelper.DeleteFile(descDirectoryPath + "\\" + sourceFileName); } File.Move(sourceFilePath, descDirectoryPath + "\\" + sourceFileName); } }
public static void ClearDirectory(string directoryPath) { if (DirFileHelper.IsExistDirectory(directoryPath)) { string[] fileNames = DirFileHelper.GetFileNames(directoryPath); for (int i = 0; i < fileNames.Length; i++) { DirFileHelper.DeleteFile(fileNames[i]); } string[] directoryNames = DirFileHelper.GetDirectories(directoryPath); for (int i = 0; i < directoryNames.Length; i++) { DirFileHelper.DeleteDirectory(directoryNames[i]); } } }