i'm making backup script in bash. , i've been testing out, , of encryption , compression, becomes slow, i've decided exclude things.
first few lines of code go [using different folder names security]:
this works.php code:
#! /bin/bash
files="music"
exclude="*.mp3"
echo compressing files...
mkdir backup
tar -pvczf backup/backup.tar.gz --exclude=$exclude $files > log.txt
echo done.
if change third line to:
this works.php code:
exclude="music/somerandomartist/*"
however, if try combine two, like:
this doesn't work, , ends excluding nothing.php code:
exclude="*.mp3 music/somerandomartist/*"
i've tried delimiting things commas instead of spaces, , still no more luck.
heh, i've tried lot of things, there's no point mentioning them all.
google no help, i'm hoping give me hand.
in advance.
i believe --exclude can handle 1 expression. nothing stops using several excludes. example:
good luck!code:... exclude1="music/somerandomartist/*" exclude2="*.mp3" tar -pvczf backup/backup.tar.gz --exclude=$exclude1 --exclude=$exclude2 $files > log.txt ...
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk [SOLVED] tar --exclude [bash]
Ubuntu
Comments
Post a Comment