#!/bin/bash function walk() { for file in `ls $1` do local path=$1"/"$file if [ -d $path ] then #echo "DIR $path" walk $path else local fv=${file##*.} local fb="png" if [ "$fv"x = "$fb"x ] then "~/"pngquant -f --ext .png --quality 80-80 $path echo $file fi fi done } if [ $# -ne 1 ] then echo "USAGE: $0 TOP_DIR" else walk $1 fi
时间: 2024-12-14 12:13:58