shell下获取指定后缀的文件
#!/usr/bin/bash
Folder_A=`pwd`
cd $Folder_A
for file_a in ${Folder_A}/*
do
filepath=`basename $file_a`
if [[ ${filepath:0-3:3} -eq "txt" ]] ##以txt文件为例##
then
echo $filepath
else
echo 0
fi
done
May we all proceed with wisdom and grace.
https://www.cnblogs.com/YlnChen/