From 655c03e6a181691b5d078506e6419b28a759af74 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 14 Jul 2019 16:43:02 +0100 Subject: [PATCH] Also archive replies --- epicyon.py | 2 +- posts.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/epicyon.py b/epicyon.py index 2259b636..6bdd2cd4 100644 --- a/epicyon.py +++ b/epicyon.py @@ -506,7 +506,7 @@ if args.archive: archiveMedia(baseDir,args.archive,archiveWeeks) archivePosts(baseDir,args.archive,archiveMaxPosts) print('Archiving complete') - sys.exit() + sys.exit() if not args.domain and not domain: print('Specify a domain with --domain [name]') diff --git a/posts.py b/posts.py index be01a0a3..7e8b76fd 100644 --- a/posts.py +++ b/posts.py @@ -997,13 +997,18 @@ def archivePostsForPerson(nickname: str,domain: str,baseDir: str, \ return for postFilename in postsInBox: - filePath = os.path.join(boxDir, postFilename) + filePath = os.path.join(boxDir, postFilename) if os.path.isfile(filePath): + repliesPath=filePath.replace('.json','.replies') if archiveDir: archivePath = os.path.join(archiveDir, postFilename) os.rename(filePath,archivePath) + if os.path.isfile(repliesPath): + os.rename(repliesPath,archivePath) else: os.remove(filePath) + if os.path.isfile(repliesPath): + os.remove(repliesPath) noOfPosts -= 1 if noOfPosts <= maxPostsInBox: break