Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bash Script to backup my "home" folder

Tags:

linux

bash

shell

sh

How can I skip backing up my "Downloads" folder?

here's my code:

#!/bin/bash

# Daily backup script

# Create some needed variable
day=$(date +%F)
Folder="/home/ME/"

File="/media/MediaTwo/Copy/UbuntuBackup/$day.tar.gz"

# Backup Server Configuration
tar cpzf $File $Folder

# Remove backup files older than 90 days
find $File* -mtime +90 -exec rm {} \;
like image 274
Kevin Avatar asked Mar 03 '26 09:03

Kevin


1 Answers

tar cpzf $File --exclude=Downloads $Folder
like image 81
R Sahu Avatar answered Mar 05 '26 22:03

R Sahu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!