Created
November 24, 2023 23:10
-
-
Save Krasipeace/0efa88ff9fa4fad8d40202cfbf6101ed to your computer and use it in GitHub Desktop.
JS script for creating many many folders
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// tested and working correcty with Node.js | |
let fs = require('fs'); | |
let path = require('path'); | |
let dir = __dirname; // `current directory` global variable | |
for (let i = 1; i <= 480; i++) { | |
let folderName = String(i).padStart(3, '0'); | |
let folderPath = path.join(dir, folderName); | |
if (!fs.existsSync(folderPath)) { | |
fs.mkdirSync(folderPath); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment