archiving (ubuntu tar) hidden directories

后端 未结 6 749
迷失自我
迷失自我 2021-02-02 11:48

tar on a directory mydir will archive hidden files and hidden subdirectories, but tar from within mydir with a * wildcard will no

6条回答
  •  不思量自难忘°
    2021-02-02 12:03

    You can compress all the files / folders in your current directory (including .hidden) by using:

    tar -zcvf compressed.tgz `ls -A -1`
    

    The last argument are the folders you want to compress. If you pass it ls -A -1 , you are passing it all folders in your current directory but . and .. . When it comes to subdirectories, .hidden files are already included in the compression by default.

提交回复
热议问题