-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate-Lambda-Zip.sh
executable file
·31 lines (24 loc) · 1.01 KB
/
generate-Lambda-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
#!/bin/bash
if [[ ${PWD##*/} != Generate-McDonalds-Mobile-Screenshot ]]; then
echo "This script can only be run in a directory named Generate-McDonalds-Mobile-Screenshot"
exit
fi
zip_exceptions=("example_screenshot.jpg" "README.md" "generate-Lambda-Zip.sh" "requirements.txt")
delete_exceptions=("resources" "example_screenshot.jpg" "lambda_function.py" "mcd_generate.py" "README.md" "requirements.txt" "generate-Lambda-Zip.sh" "archive.zip")
pip3 install -r requirements.txt -t .
# loop through all files in the current directory
for file in *; do
# check if the file is in the zip_exceptions array
if [[ ! " ${zip_exceptions[@]} " =~ " ${file} " ]]; then
# add the file to the zip archive
zip -r archive.zip "$file"
fi
done
# Loop through all files and folders in the current directory
for item in *; do
# Check if the item is not in the exceptions array
if [[ ! " ${delete_exceptions[@]} " =~ " ${item} " ]]; then
# Delete the item with -f option to force and -r option to recurse
rm -rf "$item"
fi
done