99) { $format = "%03d"; } elseif($screenshotCount > 999) { $format = "%04d"; } elseif($screenshotCount > 9999) { $format = "%05d"; } else { $format = "%06d"; // beyond this, you're on your own } rename('00000002.jpg', sprintf("%03d", $i).".jpg"); } } } else { echo "Unable to find file: {$_SERVER['argv'][1]}"; system('pause'); } ?>