Reputation: 10063
I have the following code:
private static void Download(DropboxClient client, string dropboxfolder, string localfolder, FileMetadata file)
{
//Console.WriteLine("Download file...");
var task1 = client.Files.DownloadAsync(dropboxfolder + "/" + file.Name);
task1.Wait();
using (var response = task1.Result)
{
Console.WriteLine("Downloaded {0} Rev {1}", response.Response.Name, response.Response.Rev);
Console.WriteLine("------------------------------");
using (Stream output = File.OpenWrite(Path.Combine(localfolder, response.Response.Name)))
{
var task2 = response.GetContentAsStreamAsync();
task2.Wait();
using (Stream input = task2.Result)
{
input.CopyTo(output);
}
}
Console.WriteLine("------------------------------");
}
}
how do I modify it such that the output
file will have the same timestamp as the file in dropbox.
[EDIT] I know how to set a date of a file in C#, but I don't know how to get that timestamp from dropbox in order to call that method. The question I am asking is more generic than that because perhaps there is an option on the dropbox API that allows the file to be set by dropbox.
Upvotes: 0
Views: 245
Reputation: 16940
When you use DownloadAsync
to download a file, that also returns the FileMetadata
for that file. You can check the FileMetadata.ServerModified
or FileMetadata.ClientModified
to get the modified time as desired.
You can find an example of getting the metadata here.
Upvotes: 1