Advertisement
Void-voiD

Untitled

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