Created
October 6, 2016 11:34
-
-
Save triacontane/8f15fc1b2da5e8ab39d1077fabaee2a0 to your computer and use it in GitHub Desktop.
プロジェクト内の指定したフォルダ配下の全ファイルに対して処理を実行
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
var path = require('path'); | |
// base:実行中のプロジェクトのルートパス | |
var base = path.dirname(process.mainModule.filename); | |
// filePath:base + img/pictures | |
var filePath = path.join(base, 'img/pictures/'); | |
var fs = require('fs'); | |
// img/pictures配下のファイルに対して繰り返し処理を実行 | |
fs.readdirSync(filePath).forEach(function(fileName) { | |
console.log(fileName); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment