当前位置:网站首页>Traverse the specified directory to obtain the file name with the specified suffix (such as txt and INI) under the current directory
Traverse the specified directory to obtain the file name with the specified suffix (such as txt and INI) under the current directory
2022-06-26 13:31:00 【Cold Moon Palace leader】
#!/bin/bash
######################################################################
## ##
## Traverse the specified directory to obtain the specified suffix under the current directory ( Such as txt and ini) The name of the file ##
## ##
######################################################################
## Recursive traversal
traverse_dir()
{
filepath=$1
#echo $filepath
for file in `ls -a $filepath`
do
if [ -d ${filepath}/$file ]
then
if [[ $file != '.' && $file != '..' ]]
then
# recursive
traverse_dir ${filepath}/$file
fi
else
# Call to find the specified suffix file
check_suffix ${filepath}/$file
fi
done
}
## Get suffix txt or ini The file of
check_suffix()
{
file=$1
# if [ "${file##*.}"x = "txt"x ] || [ "${file##*.}"x = "ini"x ] || [ "${file##*.}"x = "gz"x ]; then
if [ "${file##*.}"x = "jar"x ]; then
echo $file
fi
}
# Test specified directory /data_output/ci/history
traverse_dir $(cd "$(dirname "$0")";pwd)
边栏推荐
- Guruiwat rushed to the Hong Kong stock exchange for listing: set "multiple firsts" and obtained an investment of 900million yuan from IDG capital
- J - Wooden Sticks poj 1065
- Some conclusions about Nan
- Es snapshot based data backup and restore
- Use of wangeditor rich text editor
- 橋接模式(Bridge)
- Electron official docs series: Development
- MySQL explanation (II)
- Beifu twincat3 can read and write CSV and txt files
- Common faults of MySQL database - forgetting database password
猜你喜欢

Teacher Li Hang's new book "machine learning methods" is on the market! Purchase link attached

C language: Exercise 2

LAMP编译安装

ES6 module

Common faults of MySQL database - forgetting database password

Beifu PLC realizes data power-off maintenance based on cx5130

Use the script to crawl the beautiful sentences of the sentence fan website and store them locally (blessed are those who like to excerpt!)

To solve the difficulties of small and medium-sized enterprises, Baidu AI Cloud makes an example

Electron official docs series: Processes in Electron
![8. [STM32] timer (TIM) -- interrupt, PWM, input capture experiment (proficient in timer)](/img/e7/2fd8ec8d5e5473c7f84f3e3bcedca8.png)
8. [STM32] timer (TIM) -- interrupt, PWM, input capture experiment (proficient in timer)
随机推荐
J - Wooden Sticks poj 1065
SQL assigns the field value of data table B to a column in data table a
Nlp-d60-nlp competition D29
[shell] generate strings between specified dates
E - Apple Catching
Guruiwat rushed to the Hong Kong stock exchange for listing: set "multiple firsts" and obtained an investment of 900million yuan from IDG capital
Mode pont
[how to connect the network] Chapter 2 (middle): sending a network packet
First pass! Baidu AI Cloud Xiling platform has obtained the authoritative certification of digital human ability evaluation from the Institute of information technology
Awk tools
MySQL数据库讲解(三)
Es snapshot based data backup and restore
【Spark】. Explanation of several icons of scala file in idea
泰山OFFICE技术讲座:使用字体粗体的四种情形
A few lines of code can realize complex excel import and export. This tool class is really powerful!
12 SQL optimization schemes summarized by old drivers (very practical)
Firewall introduction
Beifu realizes the control of time slice size and quantity through CTU and ton
三维向量的夹角
Detailed introduction to shell script (4)