Skip to content

Commit

Permalink
add zip plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Darukutsu committed Feb 4, 2024
1 parent bd64857 commit 3836ec2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions plugins/zip
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,14 @@ password_protect(){
if [ "$encrypt" = "y" ] || [ "$encrypt" = "Y" ]; then
cd "$working_dir" || exit # some needs this
if [ "$2" ]; then
xargs -0 -I{} sh -c '
xargs -0 -I{%} sh -c '
filename=$('"$1"') &&
find . -maxdepth 1 -type f \( -name "$filename.zip" -o -name "$filename.tar*" \) \! -name "*.gpg" -exec gpg -c "{}" \; -exec rm "{}" \;
' < "$2"
elif [ "$1" ]; then
filename="$1"
find . -maxdepth 1 -type f \( -name "$filename.zip" -o -name "$filename.tar*" \) \! -name "*.gpg" -exec gpg -c "{}" \; -exec rm "{}" \;
fi

fi
}

Expand Down Expand Up @@ -127,8 +126,9 @@ zip_selection_individualy(){
xargs -0 -I{} zip -r -"$compression" "{}.zip"
else
xargs -0 -I{} tar -cvf "{}.tar" "{}" < "$selection"
compress_tar "printf '%s' '{}'" "$selection"
compress_tar 'printf "%s" "{}"' "$selection"
fi
password_protect 'basename "{%}"' "$selection"
else
if [ "$alg" = "zip" ]; then
xargs -0 -I{} sh -c '
Expand All @@ -143,8 +143,9 @@ zip_selection_individualy(){
filename=$(basename "{}") &&
tar -C "$filepath" -cvf "$filename.tar" "$filename"
' < "$selection"
compress_tar "basename '{}'" "$selection"
compress_tar 'basename "{}"' "$selection"
fi
password_protect 'basename "{%}"' "$selection"
fi
}

Expand Down

0 comments on commit 3836ec2

Please sign in to comment.