Browse Source

Create the missing files

master
Julio Biason 5 years ago
parent
commit
8f8a54b4fa
  1. 22
      src/main.rs

22
src/main.rs

@ -1,11 +1,12 @@
use std::env;
use std::collections::HashSet;
use std::env;
use std::path::Path;
use rusoto_core::Region;
use rusoto_credential::StaticProvider;
use rusoto_core::request::HttpClient;
use rusoto_credential::StaticProvider;
use rusoto_s3::ListObjectsRequest;
use rusoto_s3::PutObjectRequest;
use rusoto_s3::S3;
use rusoto_s3::S3Client;
@ -64,7 +65,24 @@ fn main() {
});
}
let missing: HashSet<_> = directory_files.difference(&files_dirs).collect();
println!("Directories with files:\n{:#?}", directory_files);
println!("Directories with controllers:\n{:#?}", files_dirs);
println!("Difference:\n{:#?}", directory_files.difference(&files_dirs));
for control in missing.iter() {
println!("Creating {}", control);
let control_file = PutObjectRequest {
bucket: bucket.to_owned(),
content_type: Some("httpd/unix-directory".to_owned()),
content_length: Some(0),
key: control.to_string(),
..Default::default()
};
match client.put_object(control_file).sync() {
Ok(_) => println!("Success!"),
Err(error) => println!("Failed to create file: {}", error)
}
}
}

Loading…
Cancel
Save