mirror of
https://github.com/Radarr/Radarr
synced 2026-04-22 13:22:32 +02: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 @@ private MovieFile TransferFile(MovieFile movieFile, Movie movie, string destinat
|
|||
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 @@ private MovieFile TransferFile(MovieFile movieFile, Movie movie, string destinat
|
|||
|
||||
_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 @@ private MovieFile TransferFile(MovieFile movieFile, Movie movie, string destinat
|
|||
|
||||
_mediaFileAttributeService.SetFilePermissions(destinationFilePath);
|
||||
|
||||
_diskProvider.DeleteFolder(oldMoviePath, true);
|
||||
|
||||
return movieFile;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue