QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1740|回复: 7

什么样将find命令所找到的文件mv 其他目录..

[复制链接]
发表于 2005-5-12 08:53:01 | 显示全部楼层 |阅读模式
find /xxx/ -type f -name "x.x"  |xargs mv -f /xxx/xxx {}\;
好不行..高手指教..
发表于 2005-5-12 08:59:38 | 显示全部楼层
[code:1]mv -f $(find /xxx/ -type f -name "x.x") target_dir[/code:1]
回复

使用道具 举报

发表于 2005-5-12 09:26:24 | 显示全部楼层
[code:1]find /xxx/ -type f -name "x.x" -exec mv -f {}\;[/code:1]

当使用诸如m v或r m命令时,可以使用- e x e c选项的安全模式
回复

使用道具 举报

 楼主| 发表于 2005-5-12 09:31:23 | 显示全部楼层
多谢版主热心帮助.
回复

使用道具 举报

发表于 2005-5-12 09:33:37 | 显示全部楼层
再给点信息:
f i n d命令是一个非常优秀的工具,它可以按照用户指定的准则来匹配文件。使用e x e c和 x a rg s可以使用户对所匹配到的文件执行几乎所有的命令。
回复

使用道具 举报

 楼主| 发表于 2005-5-12 09:37:55 | 显示全部楼层
target_dir 是不是支定目录??还是不行..出错..(-bash: syntax error near unexpected token `/home/yangqi/
回复

使用道具 举报

 楼主| 发表于 2005-5-12 09:46:19 | 显示全部楼层
find /home/yangqi/junking -type f -name "*.txt" |xargs mv -f  指定目录..不知哪里出错...

mv -f $(find /home/yangqi/junking -type f -name "x.x")  /home/kenny
也出现 mv:missing file argument



我用的是mandrake linux...
回复

使用道具 举报

发表于 2005-5-12 09:52:06 | 显示全部楼层
find /xxx/ -type f -name "x.x" -exec mv -f {}\;
这个?!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-10-3 06:35 , Processed in 0.036759 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表