mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 09:59:06 -07:00
Remove empty image folders recursively
This commit is contained in:
parent
b25d6d1e48
commit
28274d4c75
@ -190,9 +190,9 @@ namespace MediaBrowser.Providers.Manager
|
||||
|
||||
// Remove containing directory if empty
|
||||
var folder = Path.GetDirectoryName(currentPath);
|
||||
if (!_fileSystem.GetFiles(folder).Any())
|
||||
if (Directory.Exists(folder) && !_fileSystem.GetFiles(folder, true).Any())
|
||||
{
|
||||
Directory.Delete(folder);
|
||||
Directory.Delete(folder, true);
|
||||
}
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
|
@ -381,9 +381,9 @@ namespace MediaBrowser.Providers.Manager
|
||||
{
|
||||
// Always remove empty parent folder
|
||||
var folder = Path.GetDirectoryName(image.Path);
|
||||
if (Directory.Exists(folder) && !_fileSystem.GetFiles(folder).Any())
|
||||
if (Directory.Exists(folder) && !_fileSystem.GetFiles(folder, true).Any())
|
||||
{
|
||||
Directory.Delete(folder);
|
||||
Directory.Delete(folder, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user