command to zip up content

command to zip up content

Posted by: silent1643
Posted on: 2008-10-24 15:52:00

whats the command to zip up my entire domain's content
if i was in the folder /mydomain.com/


Re: command to zip up content

Posted by: sXi
Posted on: 2008-10-24 16:16:00

tar -cz -f backup.tgz *


Re: command to zip up content

Posted by: pangea33
Posted on: 2008-10-24 21:20:00

In reply to:

tar -cz -f backup.tgz *


While this command is absolutely correct, I prefer to compress the containing folder when archiving my sites. There are two reasons for this technique. First, you don't end up with the archive file mixed in with the files that it contains. Secondly, you don't end up with really messy directories when you *inevitably* decompress an archive at the wrong location. In fact, I prefer to archive to a "backups" directory under my root, but that's of no consequence for my example.

I would suggest using "tar -czf mydomain.com_YYYYMMDD.tgz mydomain.com" from the parent directory. (substituting the current date for YYYYMMDD of course)

Re: command to zip up content

Posted by: sXi
Posted on: 2008-10-24 23:45:00

In reply to:

I prefer to compress the containing folder when archiving my sites


Me too, but he stressed "if i was in the folder /mydomain.com/"

I agree it's better to be in $HOME and archive and entire domain within it's own containing folder - if it's a backup that you're actually performing. There are occassions where the retention of the domain directory becomes a hinderance though; for example when you're transporting data between accounts or hosts with pre-existing structures already in place, necessitating more convoluted commands on the receiving system.