aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Startup.Common/Migrations/MigrateUserFolders.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Startup.Common/Migrations/MigrateUserFolders.cs')
-rw-r--r--MediaBrowser.Server.Startup.Common/Migrations/MigrateUserFolders.cs36
1 files changed, 36 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Startup.Common/Migrations/MigrateUserFolders.cs b/MediaBrowser.Server.Startup.Common/Migrations/MigrateUserFolders.cs
new file mode 100644
index 000000000..5e3df5701
--- /dev/null
+++ b/MediaBrowser.Server.Startup.Common/Migrations/MigrateUserFolders.cs
@@ -0,0 +1,36 @@
+using MediaBrowser.Controller;
+using System;
+using System.IO;
+using System.Linq;
+
+namespace MediaBrowser.Server.Startup.Common.Migrations
+{
+ public class MigrateUserFolders : IVersionMigration
+ {
+ private readonly IServerApplicationPaths _appPaths;
+
+ public MigrateUserFolders(IServerApplicationPaths appPaths)
+ {
+ _appPaths = appPaths;
+ }
+
+ public void Run()
+ {
+ try
+ {
+ var rootPath = _appPaths.RootFolderPath;
+
+ var folders = new DirectoryInfo(rootPath).EnumerateDirectories("*", SearchOption.TopDirectoryOnly).Where(i => !string.Equals(i.Name, "default", StringComparison.OrdinalIgnoreCase))
+ .ToList();
+
+ foreach (var folder in folders)
+ {
+ Directory.Delete(folder.FullName, true);
+ }
+ }
+ catch (IOException)
+ {
+ }
+ }
+ }
+}