Example Directory Contains:
.htaccess
.news
info.txt
info.log
What gives, why isn't .htaccess or .news being added to the tar?
Furthermore if there is a .htaccess file in a subdirectory it is compressed.
Example Directory Contains:
.htaccess
.news
info.txt
info.log
/subdir/.htaccess/
Why is this, how do I work-around?
Solution:
Globbing with * does not include hidden files, whereas every file in a
directory (hidden ones included) are put into the archive. So you can
simply do
However, you can force the shell to include hidden files in
globbing, using
REFERENCES
http://www.linuxquestions.org/questions/linux-newbie-8/tar-doesnt-compress-hidden-files-in-the-same-directory-it-is-run-in-730222/
.htaccess
.news
info.txt
info.log
Code:
tar -cvpzf test.tgz ./*
./info.log
./info.txt
Furthermore if there is a .htaccess file in a subdirectory it is compressed.
Example Directory Contains:
.htaccess
.news
info.txt
info.log
/subdir/.htaccess/
Code:
tar -cvpzf test.tgz ./*<br />./info.log<br />./info.txt<br />./subdir/<br />./subdir/.htaccess
Solution:
Globbing with * does not include hidden files, whereas every file in a
directory (hidden ones included) are put into the archive. So you can
simply do
Code:
$ tar -cvpzf test.tgz .
globbing, using
Code:
$ shopt -s dotglob<br />$ tar -cvpzf test.tgz ./*<br />$ shopt -u dotglob # to disable the shell option
REFERENCES
http://www.linuxquestions.org/questions/linux-newbie-8/tar-doesnt-compress-hidden-files-in-the-same-directory-it-is-run-in-730222/