22 lines
699 B
Bash
22 lines
699 B
Bash
#!/bin/bash
|
|
|
|
# Tìm tất cả các tệp có tên kết thúc bằng .en.vtt nhưng không phải *.en.en.vtt hoặc *.vi.vi.vtt
|
|
find . -type f -name "*.en.vtt" ! -name "*.en.en.vtt" ! -name "*.vi.vi.vtt" -print0 | while IFS= read -r -d $'\0' file; do
|
|
# Lấy phần tên tệp trước .en.vtt
|
|
base_name=$(basename "$file" .en.vtt)
|
|
|
|
# Lấy thư mục chứa tệp
|
|
dir_name=$(dirname "$file")
|
|
|
|
# Tạo đường dẫn đầy đủ cho tệp đích
|
|
destination_file="${dir_name}/${base_name}.vi.vtt"
|
|
|
|
# Sao chép tệp
|
|
cp "$file" "$destination_file"
|
|
|
|
# In thông báo
|
|
echo "Đã sao chép: \"$file\" thành \"$destination_file\""
|
|
done
|
|
|
|
echo "Hoàn tất quá trình sao chép."
|