找不到 mod_files.sh?这里有
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
#!/usr/bin/env bash
if [[ "$2" = "" ]] || [[ "$3" = "" ]]; then
echo "Usage: $0 BASE_DIRECTORY DEPTH BITS_PER_CHAR"
echo "BASE_DIRECTORY 将在不存在时创建"
echo "DEPTH 必须是大于 0 的整数"
echo "BITS_PER_CHAR(session.sid_bits_per_character) 应该是 4、5 或 6 之一"
# https://php.net/manual/en/session.configuration.php#ini.session.sid-bits-per-character
exit 1
fi
if [[ "$2" = "0" ]] && [[ ! "$4" = "recurse" ]]; then
echo "无法创建深度为 0 的目录树,退出"
fi
if [[ "$2" = "0" ]]; then
exit 0
fi
directory="$1"
depth="$2"
bitsperchar="$3"
hash_chars="0 1 2 3 4 5 6 7 8 9 a b c d e f"
if [[ "$bitsperchar" -ge "5" ]]; then
hash_chars="$hash_chars g h i j k l m n o p q r s t u v"
fi
if [[ "$bitsperchar" -ge "6" ]]; then
hash_chars="$hash_chars w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z - ,"
fi
while [[ -d $directory ]] && [[ $( ls $directory ) ]]; do
echo "目录 $directory 不为空!您想做什么?"
options="\"删除目录内容\" \"选择另一个目录\" \"退出\""
eval set $options
select opt in "$@"; do
if [[ $opt = "删除目录内容" ]]; then
echo "删除 $directory 内容... "
rm -rf $directory/*
elif [[ $opt = "选择另一个目录" ]]; then
echo "您想选择哪个目录?"
read directory
elif [[ $opt = "退出" ]]; then
exit 0
fi
break;
done
done
if [[ ! -d $directory ]]; then
mkdir -p $directory
fi
echo "在 $directory 中创建会话路径,深度为 $depth,用于 session.sid_bits_per_character = $bitsperchar"
for i in $hash_chars; do
newpath="$directory/$i"
mkdir $newpath || exit 1
bash $0 $newpath `expr $depth - 1` $bitsperchar recurse
done