[问题]新手求一个TAR的脚本,新新的新手,以前没接触过linux,请写详细一些,麻烦了.
-
- 帖子: 2
- 注册时间: 2008-07-02 16:31
[问题]新手求一个TAR的脚本,新新的新手,以前没接触过linux,请写详细一些,麻烦了.
我想用TAR压缩指定目录下的多个文件,但每个文件单独生成一个独立的TAR文件.
比如我在当前用户名的主文件夹内,建立一个名为123的文件夹,向该文件里放1000个任意文件,如何在该文件夹下执行上面上面说的那个任务呢?
因为对脚本完全不了解,所以万分感谢请写详细一些吧.
比如我在当前用户名的主文件夹内,建立一个名为123的文件夹,向该文件里放1000个任意文件,如何在该文件夹下执行上面上面说的那个任务呢?
因为对脚本完全不了解,所以万分感谢请写详细一些吧.
-
- 帖子: 5
- 注册时间: 2007-12-05 10:16
- solcomo
- 帖子: 2838
- 注册时间: 2007-04-25 13:12
- solcomo
- 帖子: 2838
- 注册时间: 2007-04-25 13:12
- bones7456
- 帖子: 8495
- 注册时间: 2006-04-12 20:05
- 来自: 杭州
- 联系:
-
- 帖子: 1
- 注册时间: 2007-06-10 17:41
- patrickhe
- 帖子: 681
- 注册时间: 2005-07-21 19:13
- 来自: Peking, China
- 联系:
- eexpress
- 帖子: 58428
- 注册时间: 2005-08-14 21:55
- 来自: 长沙
- patrickhe
- 帖子: 681
- 注册时间: 2005-07-21 19:13
- 来自: Peking, China
- 联系:
eexpress 写了:怎么不用 {}+的啊。patrickhe 写了:用 find 命令即可代码: 全选
find ~/123/ -exec tar cf {}.tar {} \;
-exec command {} +
This variant of the -exec option runs the specified command on the selected files, but the command line is built by appending each selected file name at the
end; the total number of invocations of the command will be much less than the number of matched files. The command line is built in much the same way that
xargs builds its command lines. Only one instance of '{}' is allowed within the command. The command is executed in the starting directory.
☩✠✟