Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

Autobackup if directory size is more than 25 MB bash

echo -e "Enter your directory: c"
read -r dirname

cal_size=$(sudo du -sm $dirname | cut -f 1)

if [ $cal_size -gt 25 ]; then
        sudo tar -cf /backup/$dirname.tar $dirname
else
        echo "Backup is not important, you can skip!"
fi
 
PREVIOUS NEXT
Tagged: #Autobackup #directory #size #MB #bash
ADD COMMENT
Topic
Name
1+4 =