Copying media folder to the output directory will be the default starting from this commit.
This commit is contained in:
KnugiHK
2023-01-31 16:34:34 +08:00
parent 14b1cb7fde
commit 60575c7989

View File

@@ -93,6 +93,13 @@ def main():
default=False, default=False,
action='store_true', action='store_true',
help="Show the HEX key used to decrypt the database") help="Show the HEX key used to decrypt the database")
parser.add_option(
"-c",
"--copy-media",
dest="copy_media",
default=True,
action='store_true',
help="Copy media directory to output directory, otherwise move the media directory to output directory")
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
if options.android and options.iphone: if options.android and options.iphone:
@@ -193,13 +200,18 @@ def main():
) )
exit(2) exit(2)
if os.path.isdir(options.media) and \ if os.path.isdir(options.media):
not os.path.isdir(f"{options.output}/{options.media}"): if os.path.isdir(f"{options.output}/{options.media}"):
try: print("Media directory already exists in output directory. Skipping...")
shutil.move(options.media, f"{options.output}/") else:
except PermissionError: if options.copy_media:
print("Cannot remove original WhatsApp directory. " shutil.copytree(options.media, f"{options.output}/WhatsApp")
"Perhaps the directory is opened?") else:
try:
shutil.move(options.media, f"{options.output}/")
except PermissionError:
print("Cannot remove original WhatsApp directory. "
"Perhaps the directory is opened?")
if options.json: if options.json:
with open("result.json", "w") as f: with open("result.json", "w") as f: