pslist 发表于 2005-6-8 22:10:12

怎么这样打包 文件? 内详

我想打包自己家(/home/czy)所有文件除了 tmp这个文件夹应该怎么做??

怎么打包的时候 不把 tmp文件夹 算进去??

谢谢

dannycat 发表于 2005-6-8 22:38:57

man tar:    .
    .
    .
Local file selection:
    .
    .
    .
      --exclude=PATTERN      exclude files, given as a PATTERN
-X, --exclude-from=FILE      exclude patterns listed in FILE
    .
    .
    .

pslist 发表于 2005-6-9 08:27:10

看不大懂   :oops:

zhy2111314 发表于 2005-6-9 08:45:13

tryfind /home/czy -path "/home/czy/tmp" -prune -o -print -name "*"|xargs tar czvf all.tar.gz

dannycat 发表于 2005-6-9 11:45:55

$ cd /home/czy
$ tar -czvf /your/pack.tar.gz --exclude=tmp .

pslist 发表于 2005-6-9 12:11:59

感谢:)

zhy2111314 发表于 2005-6-9 16:50:23

$ cd /home/czy
$ tar -czvf /your/pack.tar.gz --exclude=tmp .
should be
tar czvf /your/pack.tar.gz /your/ --exclude=tmp :P

dannycat 发表于 2005-6-9 19:07:58

$ cd /home/czy
$ tar -czvf /your/pack.tar.gz --exclude=tmp .
should be
tar czvf /your/pack.tar.gz /your/ --exclude=tmp :P
小z,瞎说 :twisted:

1. 已经先 cd 到 ~ 了,这样可以不存储上级目录名。
2. 你没有看见最后的“点”吧? :roll:

按您的做法,人家要打包 /home/czy ,您却让人家打包 /your/ ,这个这个…… 不厚道吧 :wink:

zhy2111314 发表于 2005-6-9 21:46:02

sorry to dannycat, :)
我错了,呵呵,没看仔细 :oops:

dannycat 发表于 2005-6-9 21:51:57

zhy2111314, 又错啦 :mrgreen:

不是 sorry to me, 该是 sorry to pslist/fans, 你不会误导我可是会误导他(们)哈 :wink:

zhy2111314 发表于 2005-6-10 08:40:42

sorry to all who saw this post :cry:
I was wrong......
especially for pslist and dannycat :-(

jerryfleming 发表于 2005-6-10 15:32:14

我有一次这样写
tar cvfz backup.tgz ./* --exclude=static
结果执行了半天都没有停止,原来backup.tgz放在同样的目录下面,又重复被tar了N次
晕倒。。。

wanggang 发表于 2005-6-11 12:19:33


你没有看见最后的“点”吧?

最后的"."有什么作用?

zhy2111314 发表于 2005-6-12 00:29:22

最后点应该表示当前目录下吧
页: [1]
查看完整版本: 怎么这样打包 文件? 内详