Skip to content

Instantly share code, notes, and snippets.

@porfirioribeiro
Created June 4, 2020 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save porfirioribeiro/7a25e3caa3a92acb67a0a9670482b9e5 to your computer and use it in GitHub Desktop.
Save porfirioribeiro/7a25e3caa3a92acb67a0a9670482b9e5 to your computer and use it in GitHub Desktop.
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