1

I would like to compress backup directory, but not saving all path of data. After unpack i want have only destination directory. How Can I do this?

This command save all path:

$tar -czf /home/user/backup/www_`date +%Y-%m-%d`.tar.gz /home/user/www

$ tar -xvf redmine_www_2018-03-02.tar.gz 
home/user/www/
debek
  • 237

1 Answers1

4

This has already been answered a million times:

tar -czf /home/user/backup/www_`date +%Y-%m-%d`.tar.gz -C /home/user/www .
marc
  • 2,427
  • 1
    And since it’s been answered a million times, the appropriate reaction isn’t to add yet another answer, but to find an appropriate duplicate and vote for it. – Stephen Kitt Mar 02 '18 at 13:46
  • Well you're right, we should start to educate and stop with the spoiling... – marc Mar 02 '18 at 16:02