mirror of
https://github.com/hyzendust/encryptall.git
synced 2026-02-15 04:01:17 +01:00
Add: previously encrypted check
This commit is contained in:
@@ -5,20 +5,24 @@ mkdir -p Encrypted
|
|||||||
|
|
||||||
echo -n "Enter password: "
|
echo -n "Enter password: "
|
||||||
read PASSWORD
|
read PASSWORD
|
||||||
echo "Password length: ${#PASSWORD}"
|
echo ""
|
||||||
|
|
||||||
PASSFILE=$(mktemp)
|
PASSFILE=$(mktemp)
|
||||||
echo "$PASSWORD" > "$PASSFILE"
|
echo "$PASSWORD" > "$PASSFILE"
|
||||||
echo "Temp file: $PASSFILE"
|
|
||||||
|
|
||||||
for file in *; do
|
for file in *; do
|
||||||
if [ -f "$file" ] && [ "$file" != "Encrypted" ] && [ "$file" != "encryptall.sh" ]; then
|
if [ -f "$file" ] && [ "$file" != "Encrypted" ] && [ "$file" != "encryptall.sh" ]; then
|
||||||
echo "Processing: $file"
|
# Check if already encrypted previously
|
||||||
|
if [ -f "Encrypted/${file}.gpg" ]; then
|
||||||
|
echo "Skipping (already encrypted): $file"
|
||||||
|
else
|
||||||
|
echo "Encrypting: $file"
|
||||||
gpg --batch --yes --passphrase-file "$PASSFILE" --symmetric --cipher-algo AES256 -o "Encrypted/${file}.gpg" "$file"
|
gpg --batch --yes --passphrase-file "$PASSFILE" --symmetric --cipher-algo AES256 -o "Encrypted/${file}.gpg" "$file"
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "Success: $file"
|
echo "✓ Success: $file"
|
||||||
else
|
else
|
||||||
echo "Failed: $file"
|
echo "✗ Failed: $file"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user