mirror of
https://github.com/hyzendust/encryptall.git
synced 2026-02-15 00:21:18 +01:00
Initial commit
This commit is contained in:
28
encryptall.sh
Executable file
28
encryptall.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
mkdir -p Encrypted
|
||||
|
||||
echo -n "Enter password: "
|
||||
read PASSWORD
|
||||
echo "Password length: ${#PASSWORD}"
|
||||
|
||||
PASSFILE=$(mktemp)
|
||||
echo "$PASSWORD" > "$PASSFILE"
|
||||
echo "Temp file: $PASSFILE"
|
||||
|
||||
for file in *; do
|
||||
if [ -f "$file" ] && [ "$file" != "Encrypted" ] && [ "$file" != "encryptall.sh" ]; then
|
||||
echo "Processing: $file"
|
||||
gpg --batch --yes --passphrase-file "$PASSFILE" --symmetric --cipher-algo AES256 -o "Encrypted/${file}.gpg" "$file"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Success: $file"
|
||||
else
|
||||
echo "Failed: $file"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
rm -f "$PASSFILE"
|
||||
unset PASSWORD
|
||||
echo "Done!"
|
||||
Reference in New Issue
Block a user