Advertisement
Void-voiD

Untitled

Dec 19th, 2018
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #! /usr/bin/env node
  2. 'use-strict'
  3. const proc = require('process');
  4. const fs = require('fs');
  5. console.log(proc.process.argv);
  6. let t = {};
  7. t.wFT = true;
  8.  
  9. const f = (dir, len) => {
  10. const items = fs.readDirSync(dir, t);
  11. for (let i = 0; i < items.length; i++) {
  12. if (dirent.isDirectory(items[i], t)) {
  13. console.log(items[i]);
  14. f(items[i], len + 2);
  15. }
  16. else {
  17. console.log(items[i]);
  18. }
  19. }
  20. }
  21. if (proc.process.argv.length === 2) {
  22. f(proc.process.argv[1], 0);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement