diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-11-10 22:41:55 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-11-10 22:41:55 -0500 |
| commit | 1fea9ad926801c85f436e34a8756bfdc41a43a0d (patch) | |
| tree | c7c9487320cfdccbf210d9d01b28685d9bf110db /MediaBrowser.Server.Startup.Common/Migrations/MigrateUserFolders.cs | |
| parent | 4d0a47e5555e4b04967c679dd4e54e937a0bd7ca (diff) | |
fixes #945 - Add genre views to dlna
Diffstat (limited to 'MediaBrowser.Server.Startup.Common/Migrations/MigrateUserFolders.cs')
| -rw-r--r-- | MediaBrowser.Server.Startup.Common/Migrations/MigrateUserFolders.cs | 36 |
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) + { + } + } + } +} |
