batch / next.sh
zeio's picture
fix(next): uncommented python module call
ad290eb verified
raw
history blame contribute delete
658 Bytes
#!/bin/bash
set -e
increment=20
first=$1
n_items=${2:-$increment}
offset=${3:-0}
first_to_fetch=$(($first + $offset))
first_index="$(printf '%04d' $first)"
last_index="$(printf '%04d' $(($first + $increment - 1)))"
folder="threads/$first_index-$last_index"
if test ! -d "$folder"; then
mkdir $folder
fi
last_to_fetch=$(($first_to_fetch + $n_items - 1))
for i in $(seq $first_to_fetch $last_to_fetch); do
printf "Fetching page %04d...\n" $i
python -m much fetch $i -p "$folder" -i index.tsv
done
echo "Number of files in the directory '$folder': $(ls $folder | wc -l)"
echo "Number of lines in the 'index.tsv': $(cat index.tsv | wc -l)"