千家信息网

新建50000个子目录

发表于:2025-12-03 作者:千家信息网编辑
千家信息网最后更新 2025年12月03日,在一个目录下新建50000个子目录的脚本,要来测试相关性能,如,EXT4是否转换成功,因为EXT4支持无限子目录。脚本如下:#!/bin/bashi=1while [ $i -le 50000 ]do
千家信息网最后更新 2025年12月03日新建50000个子目录

在一个目录下新建50000个子目录的脚本,要来测试相关性能,如,EXT4是否转换成功,因为EXT4支持无限子目录。

脚本如下:

#!/bin/bash
i=1
while [ $i -le 50000 ]
do
if [ -d /student ];then
mkdir /student/student$i
chmod 754 /student/student$i
i=$(($i+1))
else
mkdir /student
mkdir /student/student$i
chmod 754 /student/student
i=$(($i+1))
fi
done

0