When you create a tar archive of a directory tree the hidden files are normally not included. Here’s how to include the hidden files.
Say you have a web directory called “/var/www/html/mysite/” that contains the following tree:
.htaccessindex.phplogo.jpgstyle.cssadmin_dir/.htaccessadmin_dir/includes.phpadmin_dir/index.php |
Normally you would use the tar command like this:
tar czf mysite.tar.gz /var/www/html/mysite/* |
This way all files are tarred except the .htaccess files.
The solution is actually quite simple: replace the asterisk (*) by a dot (.):
tar czf mysite.tar.gz /var/www/html/mysite/. |
This way the .htaccess files are included in the tarfile.

Recent Comments