#!/bin/bash function getdir(){ for element in ls $1
do dir_or_file=$1"/"$element if [ -d $dir_or_file ] then getdir $dir_or_file else if [ "${dir_or_file##*.}" = $suffix ]; then cp $dir_or_file $todir suffixnum=$[ $suffixnum+1 ] fi #if [ "${dir_or_file%*.}" = $preffix ]; then #echo $xx #fi fi done echo "cpfilenum to $todir= $suffixnum" }
from=$1 todir=$2 suffix=$3 suffixnum=0 getdir $1 $2 $3 &
原文链接:https://www.f2er.com/bash/389554.html