How to use these simple script

$ ./encryptdir.sh <dirname> <password>
$ ./decryptdir.sh <dirname> <password>

Example
$ ./encryptdir.sh /home/narendra/test mypassword
$ ./decryptdir.sh /home/narendra/test mypassword

==========  encryptdir.sh =========
#!/bin/bash
SOURCEDIR=$1
PASSWORD=$2
if [ -z $1 ]
then
        echo "./encryptdir.sh <dirname> <password>"
        exit 1
fi

if [ -z $2 ]
then
        echo "./encryptdir.sh <dirname> <password>"
        exit 1
fi


find "$SOURCEDIR" -not -name "*.gpg" -type f -print |while read Filename ;
do
        echo  encrypting == "$Filename" ;
        gpg -c --passphrase $PASSWORD "$Filename" ;
        rm "$Filename";
done
exit 0
==========   decryptdir.sh ==========
#!/bin/bash
SOURCEDIR=$1
PASSWORD=$2
if [ -z $1 ]
then
        echo "./decryptdir.sh <dirname> <password>"
        exit 1
fi

if [ -z $2 ]
then
        echo "./decryptdir.sh <dirname> <password>"
        exit 1
fi


find "$SOURCEDIR" -name "*.gpg" -type f -print |while read Filename ;
do
        echo  encrypting == "$Filename" ;
        gpg --passphrase $PASSWORD "$Filename" ;
        rm "$Filename";
done
exit 0

===============================================


┌─────────────────────────┐
│    Narendra Sisodiya ( नरेन्द्र सिसोदिया )
│    Society for Knowledge Commons
│    Web : http://narendra.techfandu.org
└─────────────────────────┘

-- 
l...@iitd - http://tinyurl.com/ycueutm

Attachment: encryptdir.sh
Description: Bourne shell script

Attachment: decryptdir.sh
Description: Bourne shell script

Reply via email to