/// <summary> /// Downloads a folder from Dropbox /// </summary> /// <param name="client"></param> /// <param name="remoteFolder">The path to the source folder. </param> /// <param name="localFolder"></param> /// <param name="includeSelf">If false, only the contents of the source folder are downloaded, not the source folder itself. If true, the source folder is downloaded into the target folder.</param> public static void DownloadFolder(this DropNetClient client, string remoteFolder, string localFolder, bool includeSelf) { foreach (var remoteFile in client.GetFilenames(remoteFolder)) { var parent = includeSelf ? remoteFolder.ParentDirectory() : remoteFolder; var relativeRemotePath = remoteFile.RemoveFromStart(parent); var localFilePath = localFolder.AppendPathEvenIfItIsRooted(relativeRemotePath.Replace('/', Path.DirectorySeparatorChar)); client.DownloadFile(remoteFile, localFilePath); } }