#!/bin/sh

cas_subdirs=(
  btih
  btmh
)

dirs=()

for s in ${cas_subdirs[@]}; do
  if [ -d "cas/$s" ]; then
    dirs+=("cas/$s")
  fi
done

find "${dirs[@]}" -mindepth 2 -maxdepth 2 |
LC_ALL=C sort | gzip >cas.names.txt.gz

exit



#!/usr/bin/env bash

set -eux

[root@laptop:/var/www/nginx/htdocs]# find cas/ -path x -regextype list
find: Unknown regular expression type ‘list’; valid types are ‘findutils-default’, ‘ed’, ‘emacs’, ‘gnu-awk’, ‘grep’, ‘posix-awk’, ‘awk’, ‘posix-basic’, ‘posix-egrep’, ‘egrep’, ‘posix-extended’, ‘posix-minimal-basic’, ‘sed’.



[ -e cas.files.txt.gz ]

zcat cas.files.txt.gz |
grep -E '^cas/(btih|btmh)/' |
cut -d/ -f1-4 |
uniq |
grep -v '\.torrent$' |
gzip \
>cas.names.txt.gz