Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env node
- const fs = require('fs');
- const path = require('path');
- const ids = [];
- const dir = path.resolve(__dirname, process.argv[2]);
- for (const f of fs.readdirSync(dir)) {
- const format = path.resolve(dir, f);
- for (const d of fs.readdirSync(format)) {
- const day = path.resolve(format, d);
- for (const file of fs.readdirSync(day)) {
- ids.push(Number(file.slice(file.indexOf('-', 7) + 1, file.indexOf('.', 7))));
- }
- }
- }
- ids.sort();
- const sz = ids.length;
- const lo = ids[0];
- const hi = ids[sz - 1];
- const tot = hi - lo;
- const pct = sz / tot;
- console.log({lo, hi, sz, tot, pct});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement