Advertisement
Void-voiD

Untitled

Dec 19th, 2018
194
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.  
  3. 'use-strict'
  4.  
  5. const fs = require('fs');
  6. console.log(process.argv[0]);
  7. if (process.argv.length === 2) {
  8. const f = (dir, len) => {
  9. fs.readdir(dir, function(err, items) {
  10. for (let i = 0; i < items.length; i++) {
  11. if (dirent.isDirectory(items[i])) {
  12. console.log(items[i]);
  13. f(items[i], len + 2);
  14. }
  15. else {
  16. console.log(items[i]);
  17. }
  18. }
  19. });
  20. }
  21. f(process.argv[1], 0);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement