7

Tip #362   Tar remote dir over SSH

If you work on remote boxes a lot, you ll probably need a to backup a directory from there onto your machine sooner or later.. This can easilly be done using ssh & tar; all in 1 line of (script friendly) code:

ssh user@server "cd /foo && tar cvz * --exclude=bar*" > backup.$( date +%y%m%d ).tgz


Substitute user & server by the relevant info; /foo by the map you need and bar with the stuff you dont need; execute the command; login to the server when asked & Blamo! You ll have a nice backup.date.tgz file on your machine :)