On my server there is an application directory that I need to make a full copy of it but the copy takes up a lot of space, I need to compress it and then remove it. I already use the command
tar -czf bkp-mydir-$date.tar.gz mydir/
But I need it to be removed after the compression is done. In that case I could create a .sh file with the commands below:
tar -czf bkp-mydir-$date.tar.gz mydir/
rm -Rf mydir
I wanted to do this in Bacula.