# shell遍历文件名 - 如何使用bash显示有两个子文件夹的文件夹?

## linux比较目录差异 (4)

``````a
b1
c1
b2
c1
c2
b3
c1
c2``````

``find . -type d > folders.txt``

``````b2
b3``````

``````#!/bin/bash

cd a
for i in `pwd`/* ; do
if [ -d "\$i" ]; then
DIR=0;
cd \$i;
for j in * ; do
if [ -d "\$j" ]; then
let DIR=DIR+1;
fi
done
if [ \$DIR -eq 2 ]; then
echo \$i;
fi
fi
done``````

``\$./test.sh > folder.txt``

``````cd a
find . -type d |
awk -F/ '{arr[\$2]++}END{for (a in arr) {if (arr[a] == 3) print a}}'``````

``````cd a
for i in */; do x=( \$i/*/ ); (( \${#x[@]} == 2 )) && echo "\${i%/}"; done``````

``find . -type d -links 4``
{"ft_lang_label":"__label__zh","ft_lang_prob":0.97202426,"math_prob":0.7725277,"size":1200,"snap":"2022-27-2022-33","text_gpt3_token_len":809,"char_repetition_ratio":0.08110368,"word_repetition_ratio":0.026666667,"special_character_ratio":0.31833333,"punctuation_ratio":0.16190477,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97475165,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-06-24T23:28:26Z\",\"WARC-Record-ID\":\"<urn:uuid:813f071b-7484-45ee-8104-2bf681bdcb67>\",\"Content-Length\":\"23236\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:6541ccf1-9ec7-471c-a0f7-e46ed2b750aa>\",\"WARC-Concurrent-To\":\"<urn:uuid:9b16247f-53cb-4d14-acdd-7432635cbeb5>\",\"WARC-IP-Address\":\"104.21.58.131\",\"WARC-Target-URI\":\"https://code-examples.net/zh-CN/q/e38c01\",\"WARC-Payload-Digest\":\"sha1:Y3JT3WJ7CRKHSG7JVAR2FMQ2O4WAHLT4\",\"WARC-Block-Digest\":\"sha1:NX2GFO4K64Q3BJVHNCRMXN4Y7SXU5TPF\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-27/CC-MAIN-2022-27_segments_1656103033816.0_warc_CC-MAIN-20220624213908-20220625003908-00228.warc.gz\"}"}