mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-20 21:54:25 -04:00
New: Remove empty subfolders after renaming FileSetLastWriteTime
Closes #490
This commit is contained in:
@@ -418,5 +418,19 @@ namespace NzbDrone.Common.Disk
|
||||
|
||||
return di.GetFiles().ToList();
|
||||
}
|
||||
|
||||
public void RemoveEmptySubfolders(string path)
|
||||
{
|
||||
var subfolders = GetDirectories(path);
|
||||
var files = GetFiles(path, SearchOption.AllDirectories);
|
||||
|
||||
foreach (var subfolder in subfolders)
|
||||
{
|
||||
if (files.None(f => subfolder.IsParentPath(f)))
|
||||
{
|
||||
DeleteFolder(path, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user