nbt2json icon indicating copy to clipboard operation
nbt2json copied to clipboard

Add mass convert

Open MephistoPheles666 opened this issue 4 years ago • 2 comments

I'd be extremely handy if you could add an option to convert all .nbt files in the folder where the exe is situated to .json with their respective names.

MephistoPheles666 avatar Feb 17 '21 19:02 MephistoPheles666

Hi, it's possible, but it would make more sense to use the shell to do it. If you're on Windows, you can open cmd and use something like the following (assuming your current directory is where the nbt files are and nbt2json is in the path):

for /f "delims=" %i in ('dir /b *.nbt') do @echo nbt2json --in %i --out %~ni.json

That will just print out the commands to run; make sure it looks right and then run it again minus the @echo. To mass convert back to nbt:

for /f "delims=" %i in ('dir /b *.json') do @echo nbt2json -r --in %i --out %~ni.nbt

If you're using Linux or Mac, or PowerShell, let me know. Those are probably easier.

midnightfreddie avatar Feb 18 '21 06:02 midnightfreddie

Thanks a lot sir. Thank makes my work much easier! Much appreciated!

Sincerely, Samuel

On Thu, 18 Feb 2021 at 07:37, Jim Nelson [email protected] wrote:

Hi, it's possible, but it would make more sense to use the shell to do it. If you're on Windows, you can open cmd and use something like the following (assuming your current directory is where the nbt files are and nbt2json is in the path):

for /f "delims=" %i in ('dir /b *.nbt') do @echo nbt2json --in %i --out %~ni.json

That will just print out the commands to run; make sure it looks right and then run it again minus the @echo. To mass convert back to nbt:

for /f "delims=" %i in ('dir /b *.json') do @echo nbt2json -r --in %i --out %~ni.nbt

If you're using Linux or Mac, or PowerShell, let me know. Those are probably easier.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/midnightfreddie/nbt2json/issues/18#issuecomment-781094592, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJPTB5T7JTG5VLXZGTHLCGDS7SYRBANCNFSM4XY7NIKQ .

MephistoPheles666 avatar Feb 18 '21 12:02 MephistoPheles666