SHARE
TWEET

Untitled

a guest Oct 9th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env node
  2.  
  3. const fs = require('fs');
  4. const path = require('path');
  5.  
  6. const ids = [];
  7. const dir = path.resolve(__dirname, process.argv[2]);
  8. for (const f of fs.readdirSync(dir)) {
  9.   const format = path.resolve(dir, f);
  10.   for (const d of fs.readdirSync(format)) {
  11.     const day = path.resolve(format, d);
  12.     for (const file of fs.readdirSync(day)) {
  13.       ids.push(Number(file.slice(file.indexOf('-', 7) + 1, file.indexOf('.', 7))));
  14.     }
  15.   }
  16. }
  17.  
  18. ids.sort();
  19.  
  20. const sz = ids.length;
  21. const lo = ids[0];
  22. const hi = ids[sz - 1];
  23. const tot = hi - lo;
  24. const pct = sz / tot;
  25.  
  26. console.log({lo, hi, sz, tot, pct});
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top