42 lines
846 B
Bash
Executable File
42 lines
846 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ "$#" -eq 0 ]; then
|
|
echo "Error: Please provide the source directory as an argument."
|
|
exit 1
|
|
fi
|
|
|
|
basedir="${1%/}"
|
|
|
|
echo "Found these directories:"
|
|
for dir in $basedir/*; do
|
|
if [ -d "$dir" ]; then
|
|
echo " - $dir"
|
|
fi
|
|
done
|
|
read -n1 -p "Back them up? (y/n): " answer
|
|
echo
|
|
|
|
if [ "$answer" != "y" ]; then
|
|
echo "Exiting."
|
|
exit 1
|
|
fi
|
|
|
|
for dir in $basedir/*; do
|
|
if [ -d "$dir" ]; then
|
|
echo -e "\e[1;36mProcessing folder: $dir\e[0m"
|
|
./backup2cloud.sh $dir
|
|
|
|
if [ $? -ne 0 ]; then
|
|
echo -en "\e[1;31mLast run failed. Do you want to continue? (y/n): \e[0m"
|
|
read -n1 answer
|
|
echo
|
|
if [ "$answer" != "y" ]; then
|
|
echo "Exiting."
|
|
exit 1
|
|
fi
|
|
fi
|
|
fi
|
|
done
|
|
|
|
echo -e "\e[1;32mCompleted\e[0m"
|