首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

轮换目录里面的文件

2012-10-30 
替换目录里面的文件[ !-f $1 ] && { echo can not find the file:$1exit 1}[ ! -d $2 ]&& { echo can

替换目录里面的文件
[ !  -f $1 ] && { echo "can not find the file:$1";exit 1;  }
[ ! -d $2 ]  && { echo "can not find the dir:$2";exit 1; }

fileName=`basename $1`
echo "$fileName"
for f in `find $2 -name $fileName`
do
   echo "copy file $1 to $f"
   cp $1 $f
done

echo "done"

热点排行