find-git-repositiories-and-archive.sh 353 B

12345678910
  1. #!/usr/bin/env bash
  2. set -euo pipefail # bash strict mode
  3. dt=$(date +'%Y-%m-%d')
  4. repo="repos"
  5. ext="${1:-py}"
  6. find . -type d -name ".git" -print0 | xargs --null -I{} git -C {} remote get-url origin | sort | uniq > "$repo"
  7. find . -type f -mtime -7 -size -12k -name "*.${ext}" -print0 | tar -cavf "${ext}_${dt}.tar.${2:-xz}" --null -T - "$repo"
  8. rm "$repo"