commit 05567f0c528bf7398fa97aee9b7330efcd5ea599
Author: Simon Watson <esko997@gmail.com>
Date: Sat Nov 10 12:58:04 2018 -0500
Initial Commit
diff --git a/encrypt b/encrypt
new file mode 100755
index 0000000..04002ad
--- /dev/null
+++ b/encrypt
@@ -0,0 +1,47 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+my $file;
+if ( ! defined $ARGV[0] ) {
+ print "Enter file path to encrypt: ";
+ my $input = <STDIN>;
+ chomp $input;
+ $file = $input;
+} else {
+ # Expects full path of file
+ $file = $ARGV[0];
+}
+
+if ( ! -f $file ) { die "File argument must be a plain file, $file is not a plain file or it cannot be found, exiting...\n" };
+
+system("gpg --symmetric $file") == 0 or die "Something went wrong with GPG, I didn't encrypt the file...";
+
+print "Looking for encrypted file..\n";
+my $newFilename = $file . ".gpg";
+if ( -f $newFilename ) {
+ print "Encrypted file is at: $newFilename\n";
+} else {
+ print "Something went wrong? I couldn't find the encrypted file, maybe check the dir?\n";
+ exit 1;
+}
+
+if ( ! defined $ARGV[1] ) {
+ print "Want to delete the unencrypted file? (y/n)\n";
+ my $input = <STDIN>;
+ chomp $input;
+ if ( $input eq "y" ) {
+ print "Deleting $file ..\n";
+ system("rm $file") == 0 or print "Something went wrong, didn't delete old file\n";
+ } elsif ( $input eq "n" ) {
+ print "Not deleting $file .. \n";
+ } else {
+ print "Didn't recognize your input, skipping..\n";
+ }
+} elsif ( defined $ARGV[1] && $ARGV[1] eq "--delete" ) {
+ print "Deleting $file ..\n";
+ system("rm $file") == 0 or print "Something went wrong, didn't delete old file\n";
+}
+
+