myfisher 发表于 2004-2-26 22:06:05

什么命令将一个文件拷贝到一个目录的所有子目录下?

将同一个文件拷贝到一个目录的所有子目录下(不包括子目录的子目录)

bixuan 发表于 2004-2-27 08:39:59

cp -r dir dir1
就是加上-r参数

isun 发表于 2004-2-27 09:11:13

在脚本 cptosdir 中写入

#!/usr/bin/env sh
ls -l $2 |awk '/^d/{print $9}'|while read nm
do
    cp $1 $2/$nm
done

存盘,然后执行
chmod +x cptosdir;cptosdir <file> <pdir> 或 sh cptosdir <file> <pdir>
页: [1]
查看完整版本: 什么命令将一个文件拷贝到一个目录的所有子目录下?