blob: cb566d6cf89f7a6936749fcad100494181f0766e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
using MediaBrowser.Common.IO;
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;
private readonly IFileSystem _fileSystem;
public MigrateUserFolders(IServerApplicationPaths appPaths, IFileSystem fileSystem)
{
_appPaths = appPaths;
_fileSystem = fileSystem;
}
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)
{
_fileSystem.DeleteDirectory(folder.FullName, true);
}
}
catch (IOException)
{
}
}
}
}
|