什么命令将一个文件拷贝到一个目录的所有子目录下?
将同一个文件拷贝到一个目录的所有子目录下(不包括子目录的子目录) cp -r dir dir1就是加上-r参数 在脚本 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]