Created
June 4, 2020 13:20
-
-
Save porfirioribeiro/7a25e3caa3a92acb67a0a9670482b9e5 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
const skywatchRE = /SKYWATCH_(PL_PS|S2_MS)_(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})/; | |
const entries = []; | |
for await (const dirEntry of Deno.readDir(".")) { | |
const match = dirEntry.name.match(skywatchRE); | |
if (match) { | |
const sat = match[1]; | |
const date = `${match[2]}-${match[3]}-${match[4]}T${match[5]}-${match[6]}`; | |
const renamed = `${date}_SKYWATCH_${sat}.tif`; | |
entries.push(renamed); | |
Deno.rename(dirEntry.name, renamed); | |
} | |
} | |
console.log(entries.sort()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment