---
title: "linux之shell遍历目录下所有文件"
author: "小网客"
date: "2018-05-19T13:02:22Z"
tags: []
categories: ["操作系统"]
slug: "linux-shell"
draft: false
lastmod: "2018-05-19T13:02:22Z"
id: 2423105
url: "https://snv.iteye.com/blog/2423105"
---

有时候需要写脚本批量处理数据对某目录进行遍历通知执行相关操作

```
for file in 03/*
do
    if test -f $file
    then
        echo $file
    fi
    if test -d $file
    then
        echo $file
    fi
done
```