News for hackers. Stuff that matters.
Re:Don't copy paste from a website to a terminal by pjungwir on Thursday November 12, 2015 @11:35PM (#10558020)
It's not quite the same as `cp -r`. Tar will create the directories if necessary, but it will also drop the files into an existing folder hierarchy. So you could use it to create/update a few entries in an existing tree of files. For instance you could deploy updates to a website like this (locally):

    cd ~/src/mysite && tar cf - . | (cd /var/www/public_html && tar xvf -)
or this (remotely):

    cd ~/src/mysite && tar czf - . | ssh mysite 'tar xvzf - -C /var/www/public_html'
I would probably actually use rsync for this, but there have been times the tar approach came in handy.

A long time ago, in the dark ages of version control, I used to use tar for rollback-able deployments: I would create a tarball of the files in development to be deployed, and I would create a tarball of the files in production to be overwritten. Then I could just explode one tarball to deploy and the other to rollback. Not something I'd do today, but we didn't always have such nice tools. :-)

There are no comments on this comment yet.