diff --git a/src/NzbDrone.Core/HealthCheck/Checks/RootFolderCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/RootFolderCheck.cs
new file mode 100644
index 000000000..23c9c44a2
--- /dev/null
+++ b/src/NzbDrone.Core/HealthCheck/Checks/RootFolderCheck.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Linq;
+using NzbDrone.Common.Disk;
+using NzbDrone.Core.Tv;
+
+namespace NzbDrone.Core.HealthCheck.Checks
+{
+ public class RootFolderCheck : HealthCheckBase
+ {
+ private readonly ISeriesService _seriesService;
+ private readonly IDiskProvider _diskProvider;
+
+ public RootFolderCheck(ISeriesService seriesService, IDiskProvider diskProvider)
+ {
+ _seriesService = seriesService;
+ _diskProvider = diskProvider;
+ }
+
+ public override HealthCheck Check()
+ {
+ var missingRootFolders = _seriesService.GetAllSeries()
+ .Select(s => _diskProvider.GetParentFolder(s.Path))
+ .Distinct()
+ .Where(s => !_diskProvider.FolderExists(s))
+ .ToList();
+
+ if (missingRootFolders.Any())
+ {
+ if (missingRootFolders.Count == 1)
+ {
+ return new HealthCheck(GetType(), HealthCheckResult.Error, "Missing root folder: " + missingRootFolders.First());
+ }
+
+ var message = String.Format("Multiple root folders are missing: {0}", String.Join(" | ", missingRootFolders));
+ return new HealthCheck(GetType(), HealthCheckResult.Error, message);
+ }
+
+ return new HealthCheck(GetType());
+ }
+
+ public override bool CheckOnConfigChange
+ {
+ get
+ {
+ return false;
+ }
+ }
+ }
+}
diff --git a/src/NzbDrone.Core/HealthCheck/Checks/UpdateCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/UpdateCheck.cs
index 21b76bcc0..0eb187b29 100644
--- a/src/NzbDrone.Core/HealthCheck/Checks/UpdateCheck.cs
+++ b/src/NzbDrone.Core/HealthCheck/Checks/UpdateCheck.cs
@@ -22,6 +22,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
public override HealthCheck Check()
{
+ //TODO: Check on mono as well
if (OsInfo.IsWindows)
{
try
diff --git a/src/NzbDrone.Core/MediaFiles/DiskScanService.cs b/src/NzbDrone.Core/MediaFiles/DiskScanService.cs
index 4e2801c95..a4ee5ff99 100644
--- a/src/NzbDrone.Core/MediaFiles/DiskScanService.cs
+++ b/src/NzbDrone.Core/MediaFiles/DiskScanService.cs
@@ -58,13 +58,21 @@ namespace NzbDrone.Core.MediaFiles
public void Scan(Series series)
{
+ var rootFolder = _diskProvider.GetParentFolder(series.Path);
+
+ if (!_diskProvider.FolderExists(rootFolder))
+ {
+ _logger.Warn("Series' root folder ({0}) doesn't exist.", rootFolder);
+ return;
+ }
+
_logger.ProgressInfo("Scanning disk for {0}", series.Title);
_commandExecutor.PublishCommand(new CleanMediaFileDb(series.Id));
if (!_diskProvider.FolderExists(series.Path))
{
if (_configService.CreateEmptySeriesFolders &&
- _diskProvider.FolderExists(_diskProvider.GetParentFolder(series.Path)))
+ _diskProvider.FolderExists(rootFolder))
{
_logger.Debug("Creating missing series folder: {0}", series.Path);
_diskProvider.CreateFolder(series.Path);
diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj
index ab4e30745..389d24a9d 100644
--- a/src/NzbDrone.Core/NzbDrone.Core.csproj
+++ b/src/NzbDrone.Core/NzbDrone.Core.csproj
@@ -281,6 +281,7 @@
+