'폴더 경로 찾기'에 해당되는 글 1건

  1. 2016.02.22 [Node js] - 로컬 폴더 리스트, 파일 검색 ( fs module )

[Node js] - 로컬 폴더 리스트, 파일 검색 ( fs module )

Node js 2016. 2. 22. 10:39
반응형

var $this = this;


$this.fs    = require("fs");

$this.path = "/folderPath";


$this.fs.readdir($this.path, function( err, folders ){

  for( var i = 0; i < folders.length; i++ ) {

    var folder = folders[i];

    var fPath  = $this.path + "/" + folder;  // 하위 폴더 경로 반환

    var files  = $this.fs.readdirSync( fPath );  // 하위 폴더 내 파일 검색


    console.log( fPath );

    console.log( files );

  };

});

반응형

'Node js' 카테고리의 다른 글

[Node js] - MKMysql 1.0.0 for Node js  (0) 2016.10.26
: