#!/bin/bash
for file in *
do
showname=$file
if [ -d "$file" ] # Check if it's a directory.
then
# xxxx_report echo $showname | awk '{print substr($0,1,length($0)-7)}'
# cut ?only need xxxx
targetname=`echo $showname | awk '{print substr($0,1,length($0)-7)}'`
mv $showname $targetname
echo $file "has been changed"
fi
done
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/14377/viewspace-1030554/ ,如需转载,请注明出处,否则将追究法律责任。