QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2881|回复: 5

the question about copy

[复制链接]
发表于 2007-7-4 18:23:36 | 显示全部楼层 |阅读模式
I want to copy one file to different folders at the same time. Can somebody tell me how to deal with it ?
For example, copy "hf.txt" to f01, f02, f03,... f99.
Thanks a lot!
发表于 2007-7-5 12:18:52 | 显示全部楼层
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
so you can do like this
find <start_directory>  -exec cp {} \;
回复

使用道具 举报

 楼主| 发表于 2007-7-6 17:56:14 | 显示全部楼层

回复 #2 BOoRFGOnZ 的帖子

Thank you for your help. But I want to copy one source to multiple directories at the same time. Is it possible ?
回复

使用道具 举报

发表于 2007-7-6 20:55:01 | 显示全部楼层

Please try this cmd

find . -name "f[0-9][1-9]" -type d -print -exec cp hf.txt {} \;

note:
. :is current directory
-type d :means only find directory
-print : You should use this when use -exec
{} \;  :You should  put these at end of command line when use -exec and there is a blank between } and \.

[ 本帖最后由 secpoint 于 2007-7-6 21:08 编辑 ]
回复

使用道具 举报

发表于 2007-7-8 10:28:04 | 显示全部楼层
CPU will run the command one by one, so you never do 2 or more things at the same time.
回复

使用道具 举报

发表于 2007-8-7 14:54:04 | 显示全部楼层
for dest in `seq -w 99`
do
   cp hf.txt f${dest}
done
回复

使用道具 举报

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

本版积分规则

GMT+8, 2024-11-2 00:23 , Processed in 0.135787 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

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