+ // Moves older posts to the archive
+
+ async _archive() {
+ internals.debuglog('Archiving post');
+ const post = await this._readPost(0);
+ await this._ensureDirectoryExists(this.archiveDirectory);
+
+ const targetPath = join(this.archiveDirectory, post.id);
+
+ internals.debuglog(`Removing ${targetPath}`);
+ await rm(targetPath, { recursive: true, force: true });
+ internals.debuglog(`Adding ${post.location} to ${targetPath}`);
+ await this._ensureDirectoryExists(targetPath);
+ await cp(post.location, targetPath, { recursive: true });
+ internals.debuglog(`Added ${post.location} to ${targetPath}`);
+ }
+