23,223
社区成员
发帖
与我相关
我的任务
分享
#!/bin/sh
path=/root/ //改成你的路径
filename=`ls ${path}`
tmp_date=0
for file in ${filename}
do
file_date=`echo ${file} | awk -F'-' '{print $2$3}'`
if [[ ${file_date} -gt ${tmp_date} ]];then
tmp_date=${file_date}
tmp_filename=${file}
fi
done
echo ${tmp_filename}