![](/img/trans.png)
[英]Create tar.gz archive and add all files and folders without parent folder
[英]How to create tar archive without some folders?
如何在没有某些文件夹的情况下创建tar存档?
现在,我创建文件夹的tar存档,并从中删除一些文件夹。 但这需要很长时间。
结构体:
万维网
-子f 1
-子f 2
-子f 3
只需要使用文件夹(sub f 1)和(sub f 2)创建存档(仅举例来说,我的实际结构具有更多子级别)
谢谢!
这行得通吗?
tar -cf backup.tar --exclude "www/subf3" www
// is your directory with spaces?
除了Ajreal建议的--exclude
选项之外 ,您还可以使用其他一些tar
选项(来自--help
输出):
--exclude=PATTERN exclude files, given as a PATTERN
--exclude-backups exclude backup and lock files
--exclude-caches exclude contents of directories containing
CACHEDIR.TAG, except for the tag file itself
--exclude-caches-all exclude directories containing CACHEDIR.TAG
--exclude-caches-under exclude everything under directories containing
CACHEDIR.TAG
--exclude-tag=FILE exclude contents of directories containing FILE,
except for FILE itself
--exclude-tag-all=FILE exclude directories containing FILE
--exclude-tag-under=FILE exclude everything under directories
containing FILE
--exclude-vcs exclude version control system directories
-X, --exclude-from=FILE exclude patterns listed in FILE
而且您还可以使用tardy
(tar后处理器)( 打包在Debian中 )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.