This commit is contained in:
Luca J
2019-06-09 02:36:32 +02:00
parent ebcb0c5dde
commit ac87de7e1c
31 changed files with 13817 additions and 13459 deletions

View File

@@ -1,38 +1,38 @@
#!/bin/bash
# relative or absolute path where the classes are
path=../public/data/class/*
# image filetype needs to be the same
file_type=*.jpg
# REGEX
reg='(.*)class\/([0\-9A\-z_]*)\/([0\-9A\-z_]*)\.jpg'
#reg='class\/([0\-9A\-z_]*)'
for i in $path
do
if [ -d "$i" ]; then
#echo "$i"
json_file=$i/user.json
printf '{\n"user":[\n'>$json_file
for j in $i/*
do
if [[ $j == ${file_type} ]]; then
if [[ $j =~ ${reg} ]]; then
echo "${BASH_REMATCH[3]}"
printf '"'>>$json_file
printf ${BASH_REMATCH[3]}>>$json_file
printf '",\n'>>$json_file
else
echo "TEST2"
echo $j
fi
fi
done
cat $json_file | rev | cut -c 3- | rev
fi
#!/bin/bash
# relative or absolute path where the classes are
path=../public/data/class/*
# image filetype needs to be the same
file_type=*.jpg
# REGEX
reg='(.*)class\/([0\-9A\-z_]*)\/([0\-9A\-z_]*)\.jpg'
#reg='class\/([0\-9A\-z_]*)'
for i in $path
do
if [ -d "$i" ]; then
#echo "$i"
json_file=$i/user.json
printf '{\n"user":[\n'>$json_file
for j in $i/*
do
if [[ $j == ${file_type} ]]; then
if [[ $j =~ ${reg} ]]; then
echo "${BASH_REMATCH[3]}"
printf '"'>>$json_file
printf ${BASH_REMATCH[3]}>>$json_file
printf '",\n'>>$json_file
else
echo "TEST2"
echo $j
fi
fi
done
cat $json_file | rev | cut -c 3- | rev
fi
done