免费注册 查看新帖 |

Chinaunix

广告
  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 2263 | 回复: 12
打印 上一主题 下一主题

关于cpio备份的问题!!!!着急。。。。。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-12-14 09:22 |只看该作者 |倒序浏览
在目录/xxx下。有很多目录如/usr1 /usr2 /usr3................在每一个/usr的确目录下都一个同名的目录/yyy.原来编写的脚本是自动备份目录/xxx的。现在只想备份每个/usr下的/yyy目录。。请问如何写命令。。。。。求救各位大侠。。。。。。在线等。。

论坛徽章:
0
2 [报告]
发表于 2005-12-14 10:48 |只看该作者
有多少个usr 写多少个cpio?? 我也是菜鸟 对这个问题也比较好奇 期待有人来解答下

论坛徽章:
0
3 [报告]
发表于 2005-12-14 11:10 |只看该作者
find /xxx -name 'usr*' -print | cpio -ov > tape device

ok了  这个应该是成功的 我试过了

[ 本帖最后由 nevertell 于 2005-12-14 11:21 编辑 ]

论坛徽章:
0
4 [报告]
发表于 2005-12-14 12:13 |只看该作者
find /xxx -name 'usr*' -depth -print | cpio -ov > tape device


#man find
......
-depth
      Always true; causes descent of the directory hierarchy
      to  be  done  so  that  all entries in a directory are
      acted on before the directory itself.
       This can be useful when find is used with cpio(1)  to
      transfer  files  that  are  contained  in  directories
      without write permission.

论坛徽章:
0
5 [报告]
发表于 2005-12-14 12:59 |只看该作者

回复 4楼 suisuiyouyu 的帖子

#!/bin/sh
echo "rewind"
/usr/bin/mt -f /dev/rmt/0 rewind
echo "this is enter directory"

cd /xxx
echo "starting backup"
/usr/bin/find. -print | cpio -ovcB > /dev/rmt/0n

原来程序是这么写。。。麻烦上面两位大哥看一下该怎么改。。。。不胜感激!!!

论坛徽章:
0
6 [报告]
发表于 2005-12-14 13:06 |只看该作者

回复 4楼 suisuiyouyu 的帖子

find /xxx -name 'usr*' -depth -print | cpio -ov > tape device
请问。这么写是不是会把所有/usr的目录都备份了啊。。。可每个/usr下还是有好多没用的目录的。我现在只想备份每个/usr下的一个叫/yyy的目录啊。。。。。。。。

论坛徽章:
0
7 [报告]
发表于 2005-12-14 14:19 |只看该作者
那就
find /usr/yyy -depth -print | cpio -ov > tape device

论坛徽章:
0
8 [报告]
发表于 2005-12-14 14:28 |只看该作者
期待高人吧  呵呵

论坛徽章:
0
9 [报告]
发表于 2005-12-14 14:33 |只看该作者

回复 7楼 suisuiyouyu 的帖子

suisuiyouyu大哥。。。。。谢谢您了。
不过您好象还没明白。。在/xxx下是有好多个/usr的。。如/usr1  /usr2  /usr3  /usr4...........
每个/usr下又有好多目录。其中一个叫/yyy的。。每个/uar里都有。现在想备份的是它。。。
怎么办。。。。。。???????????

论坛徽章:
0
10 [报告]
发表于 2005-12-14 14:46 |只看该作者
find /home/test/usr?/yyy -print | cpio -ov > /home/ew

这样没问题了吧
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP