up
This commit is contained in:
2025-09-14 23:13:06 +07:00
parent ee892854a6
commit 9690ed5634
80 changed files with 8417 additions and 0 deletions

26
SH/scan.sh Normal file
View File

@@ -0,0 +1,26 @@
#!/bin/bash
# Thư mục gốc của khóa học
COURSE_FOLDER="$(pwd)"
# Tìm tất cả các thư mục con
mapfile -t DIRS < <(find "$COURSE_FOLDER" -type d)
for dir in "${DIRS[@]}"; do
relative_path="${dir#*/vod/}"
OUTPUT_JSON="$dir/filelist.txt"
# Xóa tệp mdl.media cũ nếu tồn tại
rm -f "$OUTPUT_JSON"
# Tìm và sắp xếp các file .pdf và .xlsx theo thứ tự tự nhiên
mapfile -d '' -t FILES < <(find "$dir" -maxdepth 1 -type f \( -name '*.pdf' -o -name '*.xlsx' \) -print0 | sort -z -V)
for file in "${FILES[@]}"; do
filename=$(basename "$file")
vid="$relative_path/$filename"
echo "$vid" >> "$OUTPUT_JSON"
done
echo "File filelist.txt created successfully in $dir."
done