-
Notifications
You must be signed in to change notification settings - Fork 0
/
encrypt_and_zip.sh
44 lines (36 loc) · 913 Bytes
/
encrypt_and_zip.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
date_time=$(date +%d_%m_%Y_%H_%M_%S)
start_zip() {
zip --password $1 "$date_time.zip" $2
}
take_file_and_password() {
echo "Enter Path: "
read folder_or_file_path
echo "Enter Password: "
read password
if [[$1 == "file"]]; then
start_zip $password $folder_or_file_path
else
start_zip $password "$folder_or_file_path/*"
fi
}
open_menu() {
PS3='Please enter your choice: '
options=("Single File" "All files in folder" "Quit")
select opt in "${options[@]}"; do
case $opt in
"Single File")
take_file_and_password "file"
;;
"All files in folder")
take_file_and_password "folder"
;;
"Quit")
break
;;
*) echo "invalid option $REPLY" ;;
esac
done
}
# zip --password $password "$date_time.zip" $folder_path/*
open_menu