Answer the question
In order to leave comments, you need to log in
Bash error while zipping directory?
Script:
#!/bin/bash
DIRECTORY=$1
NOW=$(date +"%m-%d-%Y")
FILE="backup.tar.gz"
echo "Backing up data, please wait..."
tar -cvf $FILE $DIRECTORY
mv $FILE $NOW
sh backup.sh mail
tar: mail\r\r: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
Answer the question
In order to leave comments, you need to log in
#!/bin/bash
directory=$1
now=$(date +"%m-%d-%Y")
mkdir -p "$now"
backup_file="backup.tar.gz"
echo "Backing up data, please wait..."
tar zcvf "$backup_file" "$directory"
mv "$backup_file" "$now"
sh backup.sh mail
bash backup.sh mail
./backup.sh mail
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question