static async Task upload_file(AmazonS3Client client, LocalFileInfo localFile, String bucketName) { var putRequest = new PutObjectRequest { BucketName = bucketName, Key = localFile.RelativePath, FilePath = localFile.FullLocalPath, ContentType = localFile.ContentType }; putRequest.Headers.CacheControl = localFile.CacheControl; PutObjectResponse response = await client.PutObjectAsync(putRequest); }
// Scan all files in a local directory. // Return: path (relative to rootPath) -> object info static Dictionary <string, LocalFileInfo> ListLocalDirectory(string rootPath) { var ret = new Dictionary <string, LocalFileInfo>(); foreach (var f in Directory.EnumerateFiles(rootPath, "*", SearchOption.AllDirectories)) { if (f.EndsWith(".swp")) { continue; } var info = new LocalFileInfo(f, rootPath); Console.WriteLine("File {0}", info.RelativePath); ret.Add(info.RelativePath, info); } return(ret); }