sh225415 发表于 2007-7-4 18:23:36

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!

BOoRFGOnZ 发表于 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 {} \;

sh225415 发表于 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 ?

secpoint 发表于 2007-7-6 20:55:01

Please try this cmd

find . -name "f" -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 shouldput these at end of command line when use -exec and there is a blank between } and \.

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

bigapple2008 发表于 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.

gucuiwen 发表于 2007-8-7 14:54:04

for dest in `seq -w 99`
do
   cp hf.txt f${dest}
done
页: [1]
查看完整版本: the question about copy