target dir convert

This commit is contained in:
ElonJunior 2024-05-01 02:10:33 +08:00
parent 6b664afee7
commit 53693b16a9

View File

@ -3,24 +3,25 @@
CURRENT_DIR=$(cd $(dirname $0); pwd)
target_dir=$1
if [ ! -z "$tar_dir" ]; then
if [ -z "$target_dir" ]; then
target_dir=$CURRENT_DIR
fi
if [ ! -d "$target_dir" ]; then
echo "{$target_dir} unkown directory"
echo "${target_dir} unkown directory"
exit 1
fi
cd $target_dir
echo "finding<= ${target_dir}"
# convert
find . -type f -name "*.json" | while read filename; do
srs_file=${filename%.json}.srs
echo "source << {$filename}"
echo "output >> {$srs_file}"
echo "source << ${filename}"
./sing-box rule-set compile $filename -o $srs_file
echo -e "output >> ${srs_file}\n"
done
#END FILE