- self.copy_post(&post_location);
- self.write_metadata(metadata, &metadata_file_path);
- self.archive(&post_location);
+ let _ = remove_dir_all(&first_post_path);
+ create_dir_all(&first_post_path)?;
+
+ self.copy_post(&post_location, &first_post_path)?;
+ self.write_metadata(&metadata, &metadata_file_path)?;
+
+ // Step 2. Write into the archive
+
+ create_dir_all(&configuration.archive_directory)?;
+
+ let post_archive_path = configuration.archive_directory.join(metadata.id);
+ let _ = remove_dir_all(&post_archive_path);
+ create_dir_all(&post_archive_path)?;
+
+ self.archive(&first_post_path, &post_archive_path)?;