Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I select destination directory for tar command [closed]

I'm wanting to tar a folder called "mysite" to the destination directory: /var/backups/

I'm trying to issue the following command:

tar -C /var/www/mysite/ -zcf mysite_$(date +%y%m%d).tar.gz /var/backups/

However, it's ending up with:

tar: C: Cannot stat: No such file or directory

tar: Removing leading `/' from member names

tar: Exiting with failure status due to previous errors

I've checked and confirmed that /var/backups/ is a valid directory.

Basically what I want to do is, to tar the mysite folder "/var/backup/mysite" into a file called mysite_yymmdd.tar.gz which sould be available in /var/backups/

like image 921
user93078 Avatar asked Oct 05 '22 08:10

user93078


1 Answers

I'm not exactly sure what you want but you can just put the destination in the path

tar -zcf /var/backups/mysite_$(date +%y%m%d).tar.gz /var/www/mysite/
like image 94
Andreas Avatar answered Oct 08 '22 07:10

Andreas