const fs = require('fs');
const _path = require('path')
let path = './tmp/abc/yy'

async function main(){
    let a = await fs.promises.mkdir(path,{recursive: true });
    console.log(a);
}
main();

function dateFormat(date = new Date(), format = 'YY-MM-DD H:m:s') {
    format = format.toLocaleUpperCase();
    const config = {
        YY: date.getFullYear(),
        MM: ('0' + (date.getMonth() + 1)).substr(-2, 2), //getMonth() 方法根据本地时间返回指定日期的月份(从 0 到 11)
        DD: ('0' + date.getDate()).substr(-2, 2),
        H: ('0' + date.getHours()).substr(-2, 2),
        M: ('0' + date.getMinutes()).substr(-2, 2),
        S: ('0' + date.getSeconds()).substr(-2, 2),
    }

    for (const key in config) {
        format = format.replace(key, config[key])
    }
    return format
}

console.log(dateFormat(new Date(),'YYMMDD'))


fs.promises.rename('./2','./tmp/f2.jpg').then(value=>{
    console.log(value);
    console.log('rename ok');
})

console.log(_path.extname('abc.mjb.235'));