private void HelperRenameDirectory(string path, MovieEntry entry) { // store original path var fileInfo = new PowerPath(path); var originalPath = fileInfo.GetDirectoryPath(); // rename path var renamedPath = fileInfo.RenameLastDirectoryByPattern(_settings.FolderRenamePattern, entry); if (_settings.SwapThe) { renamedPath.SwapLastDirectoryName(Commons.TheName); } var directoryPath = renamedPath.GetDirectoryPath(); // rename if (originalPath == directoryPath) { return; } Directory.Move(originalPath, directoryPath); }
private void RenameDirectory(PowerPath fileInfo, MovieEntryFacade entry) { var originalFilePath = fileInfo.GetDirectoryPath(); var renamedPath = fileInfo.RenameLastDirectoryByPattern(FolderRenamePattern, entry); if (SwapThe) { renamedPath.SwapLastDirectoryName(Commons.TheName); } var directoryPath = renamedPath.GetDirectoryPath(); if (originalFilePath == directoryPath) { return; } Directory.Move(originalFilePath, directoryPath); var name = Path.GetFileName(entry.FullPath); Debug.Assert(name != null); entry.FullPath = Path.Combine(directoryPath, name); }