2023-07-27 12:53:13 -06:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Get the current timestamp in the format DD-MM-YY-TIME
|
|
|
|
timestamp=$(date +"%d-%m-%y-%H%M%S")
|
|
|
|
|
|
|
|
# Define the source file and the destination directory and file
|
|
|
|
src="data.db"
|
|
|
|
dst_dir="backups"
|
|
|
|
dst_file="data-${timestamp}.db"
|
|
|
|
|
|
|
|
# Make backups dir if necessary
|
|
|
|
mkdir -p $dst_dir
|
|
|
|
|
|
|
|
# Move and rename the file
|
2023-08-02 11:40:41 -06:00
|
|
|
cp "${src}" "${dst_dir}/${dst_file}"
|
2023-07-27 12:53:13 -06:00
|
|
|
|
|
|
|
echo "File has been moved to ${dst_dir} and renamed to ${dst_file}"
|