1、linux 遍历文件夹下所有文件
#! /bin/bash
function read_dir(){
for file in `ls $1` #注意此处这是两个反引号,表示运行系统命令
do
if [ -d $1"/"$file ] #注意此处之间一定要加上空格,否则会报错
then
read_dir $1"/"$file
else
echo $1"/"$file #在此处处理文件即可
fi
done
}
#读取第一个参数
read_dir $1
2、demo测试遍历目录
#!/bin/sh
list_alldir(){
for file2 in `ls -a $1`
do
if [ x"$file2" != x"." -a x"$file2" != x".." ];then
if [ -d "$1/$file2" ];then
echo "$1/$file2" >>getdir.txt
list_alldir "$1/$file2"
fi
fi
done
}
list_alldir ./ctf

![[pywxdump] 解密微信部分数据库-微慑信息网-VulSee.com](https://vulsee.com/wp-content/uploads/2026/06/fc478f3bb9d52020622bef86acd3eefe.png)





![[美图] 台湾某房屋广告女主角-陈匡怡家居自拍-微慑信息网-VulSee.com](http://www.173mimi.cn/uploads/allimg/081127/0312420.jpg)

![[测试]Apache Solr远程命令执行漏洞-微慑信息网-VulSee.com](http://vulsee.com/wp-content/uploads/2019/10/151.png)




![[八卦] 王婷婷—揭秘一个大三女生的性爱录像-微慑信息网-VulSee.com](http://free.86hy.com/crack/pic/1.jpg)
![[随笔]今天国际警察节-微慑信息网-VulSee.com](http://photo.sohu.com/20041017/Img222528326.jpg)

青云网
