fix-torrent-files.sh 318 B

12345678910111213141516171819
  1. #!/usr/bin/env bash
  2. set -euo pipefail # bash strict mode
  3. path="${1:=PWD}"
  4. suffix="${2:-part}"
  5. files=$(find "$path" -type f -name "*.${suffix}")
  6. arr=()
  7. for file in $files; do
  8. arr+=("${file%.${suffix}}")
  9. done
  10. for file in ${arr[@]}; do
  11. echo "$file"
  12. done
  13. # for file in "${arr[@]}"; do
  14. # echo "$file"
  15. # done