Created
October 21, 2022 00:42
-
-
Save andreigec/537f518f4cdd9a954272a819a6f3da74 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
import path from 'path' | |
import fs from 'fs' | |
var f1=fs.readdirSync("./").filter(x=>x.endsWith(".srt")||x.endsWith(".webm")) | |
f1.forEach(f=>{ | |
var d1=f.match(/(.*?202[12] )/gim)?.[0] | |
if (!d1){ | |
return | |
} | |
var d2= new Date(d1) | |
var d3=d2.toISOString().split('T')[0] | |
var newf=d3+" "+f.substring(d1.length) | |
console.log("x=",f,newf) | |
fs.renameSync(f,newf) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment