焦油:添加当前目录中的所有文件和目录包括.svn文件等 [英] tar: add all files and directories in current directory INCLUDING .svn and so on
问题描述
我尝试tar.gz的一个目录,并用
I try to tar.gz a directory and use
tar -czf workspace.tar.gz *
由此产生的焦油包含子目录,但不是在当前目录的.svn
目录(如 *
被扩大到只有可见的文件之前,它被传递给tar
The resulting tar includes .svn
directories in subdirs but NOT in the current directory (as *
gets expanded to only 'visible' files before it is passed to tar
我试图
焦油-czf workspace.tar.gz。
,而不是后来我收到因错误'。在阅读了变化:
tar -czf workspace.tar.gz .
instead but then I am getting an error because '.' has changed while reading:
tar: ./workspace.tar.gz: file changed as we read it
有没有窍门,使 *
目录中的所有文件(包括点状prefixed)匹配?
Is there a trick so that *
matches all files (including dot-prefixed) in a directory?
(在Linux上使用bash的SLES-11(2.6.27.19)
(using bash on Linux SLES-11 (2.6.27.19)
推荐答案
如果您的真正的不希望包含在压缩包顶层目录(这就是一般坏主意):
If you really don't want to include top directory in the tarball (and that's generally bad idea):
tar czf workspace.tar.gz -C /path/to/workspace .
这篇关于焦油:添加当前目录中的所有文件和目录包括.svn文件等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!