Created
December 16, 2020 14:36
-
-
Save komtaki/ebe139641ccc3d0c9119fa9f1aaffe05 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu | |
readonly HOME_DIR=$(pwd) | |
readonly INPUT_DIR="${HOME_DIR}/dataset" | |
readonly RESULT_DIR="${HOME_DIR}/result" | |
if [ ! -d "${RESULT_DIR}" ]; then | |
mkdir "${RESULT_DIR}" | |
fi; | |
ls -1 "${INPUT_DIR}" | while read -r filePath | |
do | |
password="${filePath/'.pdf'/}" | |
echo "Succeed to lock!! filename: ${filePath} password: ${password}" | |
qpdf --encrypt "${password}" "${password[0]}" 40 -- "${INPUT_DIR}/${filePath}" "${RESULT_DIR}/${filePath}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment