public static IFileNode ListRecurse(this IWalker walker, IFile file) { if (file.IsFolder()) { var children = walker.List(file.Id); return new FileNode(file, children.Select(c => ListRecurse(walker, c))); } else { return new FileNode(file); } }
/// <summary> /// Back up the given file or folder to the specified directory. /// If this is a folder, it will be recursively backed up, /// sending more requests to Google Drive to fetch the subfolder contents. /// </summary> /// <param name="file">The file or folder to backup</param> /// <param name="destinationDirectory">The directory to backup into</param> public void Backup(IFile file, string destinationDirectory) { if (file.IsFolder()) { string subDirectory = _fileSystem.Path.Combine(destinationDirectory, file.Name); Backup(file.Id, subDirectory); } else { Download(file, destinationDirectory); } }