From c0919242c2799bc31a53e956092fd506ca0e07a1 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 23 Aug 2020 22:21:36 -0700 Subject: [PATCH] Only add -r recurse flag if input path is directory. I discovered an issue when the input path was a file, winrar was trying to access a sibling directory (particularly $recycle.bin while on drive root) and raising permission denied errors. --- rarpar.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rarpar.py b/rarpar.py index ebc9647..c4376c8 100644 --- a/rarpar.py +++ b/rarpar.py @@ -52,7 +52,7 @@ def RARCOMMAND( ''' command = [ 'winrar', - 'a -ibck -ma -m0 -mt1 -ri1:30 -r -ep1', + 'a -ibck -ma -m0 -mt1 -ri1:30 -ep1', '-y -xthumbs.db -xdesktop.ini', ] if volume is not None: @@ -67,6 +67,9 @@ def RARCOMMAND( if password is not None: command.append(f'-hp{password}') + if path.is_dir: + command.append('-r') + if path.is_dir: input_pattern = path.absolute_path + '\\*' else: