#!/bin/bash # shell脚本文件路径 shellFilePath=$(cd "$(dirname "$0")"; pwd) # echo "shell脚本文件路径:" $shellFilePath appResFolderPath=$1 #参数$1:app资源文件夹 #参数$2:需要拷贝的文件夹 #参数$3:是否递归拷贝 #参数$4:拷贝是否保留相对文件夹 function copyFiles() { if [ ! -d $1 ]; then echo "创建文件夹:" $1 mkdir $1 fi if [ -f $2 ]; then echo "拷贝文件:" $2 cp $2 $1 else if [ -s $2 ]; then for file in $2/*; do if [ -d $file ]; then if [ $3 == "true" ]; then if [ $4 == "true" ]; then copyFiles $1'/'$(basename $file) $file $3 $4 else copyFiles $1 $file $3 $4 fi fi else copyFiles $1 $file $3 $4 fi done fi fi } copyFiles $appResFolderPath $shellFilePath'/../ccbi' "true" "false" copyFiles $appResFolderPath $shellFilePath'/../config' "true" "false" copyFiles $appResFolderPath $shellFilePath'/../font' "true" "false" copyFiles $appResFolderPath $shellFilePath'/../plist' "true" "false" copyFiles $appResFolderPath $shellFilePath'/../png_noplist' "true" "false" copyFiles $appResFolderPath $shellFilePath'/../png_plist' "true" "false" copyFiles $appResFolderPath $shellFilePath'/../img_single' "true" "false" copyFiles $appResFolderPath $shellFilePath'/../轮廓' "true" "false"