Remove old folder and all contents

pull/2/head
Tim Turner 8 years ago
parent 7bb319b6d6
commit a8eec60c9d

@ -102,8 +102,6 @@ namespace NzbDrone.Core.MediaFiles
Ensure.That(movie,() => movie).IsNotNull();
Ensure.That(destinationFilePath, () => destinationFilePath).IsValidPath();
var movieFilePath = movieFile.Path ?? Path.Combine(movie.Path, movieFile.RelativePath);
if (!_diskProvider.FileExists(movieFilePath))
@ -118,6 +116,9 @@ namespace NzbDrone.Core.MediaFiles
_diskTransferService.TransferFile(movieFilePath, destinationFilePath, mode);
var oldMoviePath = new OsPath(movieFilePath).Directory.FullPath.TrimEnd(Path.DirectorySeparatorChar);
var newMoviePath = new OsPath(destinationFilePath).Directory.FullPath.TrimEnd(Path.DirectorySeparatorChar);
movie.Path = newMoviePath;
@ -137,6 +138,8 @@ namespace NzbDrone.Core.MediaFiles
_mediaFileAttributeService.SetFilePermissions(destinationFilePath);
_diskProvider.DeleteFolder(oldMoviePath, true);
return movieFile;
}

Loading…
Cancel
Save