pep503.sh (762B)
1 #!/usr/bin/env 2 3 s=$1 4 d=$2 5 if [ -z $d ]; then 6 >&2 echo "usage: pep503.sh <source_dir> <dest_dir>" 7 exit 1 8 fi 9 10 for df in `find $s -name "*.whl" -type f`; do 11 f=`basename $df` 12 pd=`echo $f | sed -e "s/^\(.*\)-[[:digit:]]*\.[[:digit:]].*$/\1/g" | tr "[:upper:]" "[:lower:]" | tr "_" "-"` 13 mkdir -v $d/$pd 14 cp -v $df $d/$pd/ 15 done 16 for df in `find $s -name "*.tar.gz" -type f`; do 17 f=`basename $df` 18 pd=`echo $f | sed -e "s/^\(.*\)-[[:digit:]]*\.[[:digit:]].*$/\1/g" | tr "[:upper:]" "[:lower:]" | tr "_" "-"` 19 mkdir -v $d/$pd 20 cp -v $df $d/$pd/ 21 done 22 for df in `find $s -name "*.zip" -type f`; do 23 f=`basename $df` 24 pd=`echo $f | sed -e "s/^\(.*\)-[[:digit:]]*\.[[:digit:]].*$/\1/g" | tr "[:upper:]" "[:lower:]" | tr "_" "-"` 25 mkdir -v $d/$pd 26 cp -v $df $d/$pd/ 27 done