Created
April 17, 2020 13:32
-
-
Save scalopus/2037a8a682b193794b4dfd25bdac4f9d to your computer and use it in GitHub Desktop.
File System Monitoring : PDF and then automatic decrypted the file to the new folder
This file contains hidden or 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
# Useful for the Bank transaction / Statement / or same password | |
# which it enable us to just download to the folder and then the | |
# script will automatic decrpyted the password and store the new | |
# file without password needs. | |
# Pre-requirement | |
# apt install qpdf fswatch | |
export PASSWORD=<pdfpasswordhere> | |
export EXPORTDIR=./decrypt | |
fswatch --insensitive --include "\\.pdf$" --exclude ".*" \ | |
--event Created --event Updated --event Renamed --event MovedTo \ | |
-0 . | \ | |
xargs -0 -n1 -t -I {} sh -c 'FILENAME=$(basename "{}"); \ | |
qpdf --decrypt --password=$PASSWORD "$FILENAME" $EXPORTDIR/$FILENAME' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment