         throw err unless err.code is 'EEXIST'
 
     if Date.now() >= nextLogTime
-        percent = 100 * (i + 1) / totalNumIds
-        remaining = totalNumIds - (i + 1)
+        remaining = idFileNames.length
+        percent = 100 * (totalNumIds - remaining) / totalNumIds
         echo "#{percent.toFixed 2}% processed; #{remaining} files remaining."
         nextLogTime = Date.now() + 1000 * 60
 

config = require '../config'
crypto = require 'crypto'
echo = console.log
FS = require 'fs'
Path = require 'path'


DIR_BY_URL_PATH = Path.join config.DATA_DIR, 'content-by-url'

DIR_PATH_FROM_URL_TO_ID = Path.relative DIR_BY_URL_PATH, DIR_BY_ID_PATH

# How many files to process in parallel:
NUM_PARALLEL = 100

getFilePathForId = (id) ->
    # NOTE: Since file systems are typically case-insensitive (even though
