Linux 如何在没有文件夹的情况下创建tar存档?

Linux 如何在没有文件夹的情况下创建tar存档?,linux,tar,Linux,Tar,如何在没有文件夹的情况下创建tar存档 现在我正在创建文件夹的tar存档并从中删除一些文件夹。但这需要很长时间 结构: www -子F1 -子F2 -子f 3 只需要使用文件夹(子f 1)和(子f 2)创建存档 (仅举个例子,我的结构确实有更多的子级别) 谢谢 这样行吗 tar -cf backup.tar --exclude "www/subf3" www // is your directory with spaces? 除了建议的--exclude选项外,您还可以使用其他一些tar选项(

如何在没有文件夹的情况下创建tar存档

现在我正在创建文件夹的tar存档并从中删除一些文件夹。但这需要很长时间

结构:

www
-子F1
-子F2
-子f 3

只需要使用文件夹(子f 1)和(子f 2)创建存档 (仅举个例子,我的结构确实有更多的子级别)

谢谢

这样行吗

tar -cf backup.tar --exclude "www/subf3" www
// is your directory with spaces?
除了建议的
--exclude
选项外,您还可以使用其他一些
tar
选项(来自
--help
输出):

您还可以使用tar后处理器(即

  --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