Skip to content

Instantly share code, notes, and snippets.

@AtWhuhu
AtWhuhu / file.js
Created August 14, 2020 06:51
遍历文件并移动
const fs = require('fs');
const path=require('path');
//遍历文件
function travel(dir,callback){
fs.readdirSync(dir).forEach((file)=>{
var pathname=path.join(dir,file)
if(fs.statSync(pathname).isDirectory()){
travel(pathname,callback)
}else{
callback(pathname)