Created
September 3, 2021 13:50
-
-
Save Flyrell/3858f0f9d7cb0eaf968be619917e79ee to your computer and use it in GitHub Desktop.
Renamer for results from https://jaxry.github.io/panorama-to-cubemap/
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
#!/usr/local/bin/node | |
const fs = require('fs'); | |
const path = require('path'); | |
const arguments = process.argv.slice(2); | |
const folder = arguments[0]; | |
const filePrefix = arguments[1]; | |
const map = { | |
py: 'u', | |
pz: 'f', | |
ny: 'd', | |
nx: 'l', | |
px: 'r', | |
nz: 'b', | |
}; | |
const files = fs.readdirSync(folder); | |
for (const file of files) { | |
const fileName = path.parse(file).name; | |
if (map[fileName]) { | |
const suffix = map[fileName]; | |
const newFileName = `${filePrefix}_${suffix}.jpg`; | |
fs.renameSync(path.join(folder, file), path.join(folder, newFileName)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment