English 中文(简体)
1. 秘密目录和tar
原标题:archiving hidden directories with tar

。 这是否是已知的不一致或矛盾?

Edit: 补充资料。 mydir的非隐蔽次中,隐藏的档案和隐蔽的子目将被存档。 换言之,在名录树中,隐藏的物体将被存档。

最佳回答

答案是:* 野生卡由壳体处理,它只是不延伸到从 do起的东西。 其他野生生物卡<代码>?也没有扩大到从狗开始的东西。 由于Keith指出,这是扩大的空壳,因此与<条码>tar/代码”无关。

如果您使用<代码>shopt -s dotglob,则扩大范围将包括等内容。 感谢安迪。

http://code>shopt -u dotglob, 以便予以撤销。

<代码>dotglob选项的转换并不改变ls本身。 相反,它只是改变扩张行为,如ls *

Edit: My recommendations are in a comment below.

问题回答

有了野心,它不会奏效。 您必须具体说明。 如果你指包括隐蔽档案在内的完整目录(现称目录)。 你可以做些什么。

tar -cvpzf test.tgz .

您可以使用:

tar -cvpzf test.tgz * .??*

But, this works only for hidden files with names > 2 (to prevent . and .. )

您可以使用:

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.

壳体会扩大野心,甚至看上去。 如果你想这样做,你就必须明确补充这些内容。 (。 然而,tar一个单一名录非常常见,这样,当你不停时,它就座落在同一个地方。

shopt -s dotglob

这将使

这将阻止所有隐藏的档案和目录。

tar -cvzf hidden.tgz `ls -a | egrep [.][^.]+`




相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...