mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-23 14:55:20 -07:00
Remove old folder and all contents
This commit is contained in:
parent
7bb319b6d6
commit
a8eec60c9d
1 changed files with 5 additions and 2 deletions
|
@ -102,8 +102,6 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
Ensure.That(movie,() => movie).IsNotNull();
|
Ensure.That(movie,() => movie).IsNotNull();
|
||||||
Ensure.That(destinationFilePath, () => destinationFilePath).IsValidPath();
|
Ensure.That(destinationFilePath, () => destinationFilePath).IsValidPath();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var movieFilePath = movieFile.Path ?? Path.Combine(movie.Path, movieFile.RelativePath);
|
var movieFilePath = movieFile.Path ?? Path.Combine(movie.Path, movieFile.RelativePath);
|
||||||
|
|
||||||
if (!_diskProvider.FileExists(movieFilePath))
|
if (!_diskProvider.FileExists(movieFilePath))
|
||||||
|
@ -118,6 +116,9 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
|
|
||||||
_diskTransferService.TransferFile(movieFilePath, destinationFilePath, mode);
|
_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);
|
var newMoviePath = new OsPath(destinationFilePath).Directory.FullPath.TrimEnd(Path.DirectorySeparatorChar);
|
||||||
movie.Path = newMoviePath;
|
movie.Path = newMoviePath;
|
||||||
|
|
||||||
|
@ -137,6 +138,8 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
|
|
||||||
_mediaFileAttributeService.SetFilePermissions(destinationFilePath);
|
_mediaFileAttributeService.SetFilePermissions(destinationFilePath);
|
||||||
|
|
||||||
|
_diskProvider.DeleteFolder(oldMoviePath, true);
|
||||||
|
|
||||||
return movieFile;
|
return movieFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue