#!/bin/bash
# 递归文件夹,查询zip文件
function readZipFile ()
{
for file in `ls $1`
do
# -d表示这个是 文件夹
if [ -d $1"/"$file ]
then
# 是文件夹就递归
readZipFile $1"/"$file
else
# 判断是否是zip文件
if echo $1"/"$file | grep -q -E '.zip'
then
# 输出文件的地址
echo $1"/"$file
fi
fi
done
}
path="/home/"
readZipFile $path
shell脚本实现遍历文件夹查找指定文件
最新推荐文章于 2025-05-02 09:00:17 发布