private async Task ClearRemoteFolder(IRemoteClient client, string path, IReadOnlyCollection <string> skipPaths) { if (skipPaths != null && skipPaths.Contains(path)) { return; } IRemoteFolder folder = await GetFolder(client, path); if (folder == null) { return; } foreach (IRemoteFolder subFolder in folder.SubFolders) { if (skipPaths != null && skipPaths.Contains(subFolder.Path)) { continue; } await DeleteFolder(client, subFolder.Path); } foreach (IRemoteFile file in folder.Files) { if (skipPaths != null && skipPaths.Contains(file.RelativePath)) { continue; } await client.DeleteFile(file.Path); } }