Last active
May 31, 2017 15:35
-
-
Save cphyc/c60090f3e9ab6125f0eb1edbf31bb15f to your computer and use it in GitHub Desktop.
Follow the number of files created
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bash | |
# To use: | |
# watch_count PATTERN [ARGS...] | |
# It will match the PATTERN and pass any remaining args to tqdm (that | |
# you need btw) | |
function watch_count { | |
pattern=$1 | |
shift | |
curr=0 | |
while true; do | |
sleep 2 | |
prev=$curr | |
curr=$(ls $pattern | wc -l) | |
diff=$((curr-prev)) | |
if [ ! "$diff" -eq "0" ]; then | |
for i in $(seq $prev $curr); do | |
echo $i | |
done | |
fi | |
done | tqdm $@ > /dev/null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment