打印

the question about copy

the question about copy

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!

TOP

Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
so you can do like this
find <start_directory>  -exec cp {} \;
Weiwei加油   我要追三顺!

TOP

回复 #2 BOoRFGOnZ 的帖子

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

TOP

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 编辑 ]
滴水成河,聚沙成塔。

TOP

CPU will run the command one by one, so you never do 2 or more things at the same time.
bigapple --------------- 浙江工业大学校园联络员

TOP

for dest in `seq -w 99`
do
   cp hf.txt f${dest}
done
--我:其实,我是一个linux系统管理员! --柏芝:你不就是一个死搞电脑的嘛! --我:小姐,就算你要说我是一个搞电脑的,也请不要在前面加一个"死"字. windows是一头性格温顺的驴,每个人都可以顺顺当当的骑上去,但是它跑不快,跑不远. linux是一匹性格很烈的野马,不是说想骑就骑的,但是一旦你摸到了他的脾性,可以驾驭它的时候,他比任何驴都跑的快. 也能给你带来驰骋的感觉

TOP