はじめに
「001」「002」「003」・・・「100」のような大量のフォルダを作成する必要があり、手作業でやるのは馬鹿馬鹿しいのでNode.jsで作ってみました。Windowsで動作します。
mkdir.js
constfs=require('fs')// プログラム実行ディレクトリ配下を指定constrootPath=process.cwd()+'\\';for(leti=1;i<=100;i++){constnum=('000'+i).slice(-3);constdirectoryPath=rootPath+num;fs.stat(directoryPath,(error,stats)=>{if(error){if(error.code==='ENOENT'){fs.mkdir(directoryPath,(error)=>{if(error){throwerror}else{console.log(`${directoryPath}ディレクトリを作成できました。`)}});}else{console.log(error);}}else{console.log(`${directoryPath}ディレクトリは既に存在します。`);}})}