 # How many files to process in parallel:
 NUM_PARALLEL = 100
 
+# How frequently to log progress:
+LOG_FREQUENCY_SECS = 60
+
 getFilePathForId = (id) ->
     # NOTE: Since file systems are typically case-insensitive (even though
     # they're case-aware), prefix capital letters with an underscore.

# Since we're going to be I/O bound here, we parallelize heavily.
echo 'Processing...'
funnel = flows.funnel NUM_PARALLEL
nextLogTime = Date.now() + 1000 * 60

while idFileNames.length then funnel _, (_) ->
    # Grab an ID file and remove it from our array (to reduce memory usage).

        remaining = idFileNames.length
        percent = 100 * (totalNumIds - remaining) / totalNumIds
        echo "#{percent.toFixed 2}% processed; #{remaining} files remaining."
        nextLogTime = Date.now() + 1000 * LOG_FREQUENCY_SECS

echo 'All done!'
