-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSubProcessOfRestore.sh
More file actions
30 lines (28 loc) · 1.07 KB
/
Copy pathSubProcessOfRestore.sh
File metadata and controls
30 lines (28 loc) · 1.07 KB
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
#!/bin/bash
# Basic backup restore script. the contents of the zip will be restored up one directory and directly into the specified folder.
# eg:
# backup.zip is located in '/files/backups' and contains: file1, file2, file3
# if the entered folder name is 'MyFolder' then it will be restored to '/files/MyFolder'.
# MyFolder will contain: file1, file2, file3
echo "Please enter the zip you wish to restore and the resulting folder's name [eg: folder.zip FolderName]"
echo "Available zips are listed below"
echo "-----------------------------"
ls -hC *.zip
echo "-----------------------------"
read -p "Enter zip and final name: " ZIP FolderName
echo ""
if [ -d "../$FolderName" ]; then
read -p "Folder already exists! (1)Replace or (2)Merge?: " CHOICE
if [ "$CHOICE" -eq 1 ]; then
echo "Replacing"
rm -r ../$FolderName && unzip -od ../$FolderName $ZIP
else
echo "Merging"
unzip -od ../$FolderName $ZIP
fi
else
echo "Creating '$FolderName' one directory up"
unzip -od ../$FolderName $ZIP
fi
echo "Restoration Completed"
read -p "Press [Enter] to close" a && exit