nodejs fs module 소개

Today I felt very annoying to make a directory every day to create a new post. Because how my docpad blog system configured is to save each post into the folder named according to date information. For example today is 2014-04-05 then the directory structure will be like 2014/04/05/created_file. Hence I need to create day folder everyday since day will be chanaged everyday. If month changed then I also need to create month folder.Therefore I want to automate the whole process to make the procedure simple.The first thing I have done is to choose a proper task programWhat I try to do is to make a recursive directory according to today date.

~~~~~nodejsdirs.map(function(dir) {dirpath += «/» + dirconsole.log(«loop =>» + dirpath);fs.mkdir(dir_path, 0755, true, function (err) {if (err) {console.log(err);} else {console.log('Directory' + directory + ’ created.’);}});});~~~~~

Tags: nodejs fs
Sunday, 6 April 2014, 11:51
comments powered by Disqus