Home > OS >  How do I convert all base64-encoded text files in a folder to PDF files on MacOS?
How do I convert all base64-encoded text files in a folder to PDF files on MacOS?

Time:12-20

I have a folder with many *.txt files that contain base64-encoded data. I want to automatically decode them and save them as a *.pdf file. How would I do that?

I'm using MacOS.

CodePudding user response:

On MacOS, open a terminal in your folder where you only have all your base64-encoded *.txt files.

Then run:

for f in *.*; do cat ${f} | base64 -d > ${f%.*}.pdf; done

Now you should have a *.pdf file for each of your *.txt file in the same folder.

  • Related