Skip to content

Instantly share code, notes, and snippets.

@dark452
Created April 9, 2020 00:31
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 dark452/69470ca97a4493bb835f9c8ae22b1650 to your computer and use it in GitHub Desktop.
Save dark452/69470ca97a4493bb835f9c8ae22b1650 to your computer and use it in GitHub Desktop.
Transform all the hex files stored in a folder to pdf
#!/bin/bash
#----------------------------------------------------------------------------
#-- description : Transform all the hex files in the folder to pdf
#----------------------------------------------------------------------------
#-- Script by Ingeborg Muñoz - imunoz@redeshost.cl
#----------------------------------------------------------------------------
T="$(date +%s)"
SOURCE_FOLDER="/home/some_home/PDFs_Files/"
TYPE="$1/"
EXTENSION=".pdf"
files=`cd $SOURCE_FOLDER$TYPE; ls | grep -E '.hex'`
echo "Checking in ...$SOURCE_FOLDER$TYPE"
for file in $files; do
echo "transforming ... $file"
xxd -p -r $SOURCE_FOLDER$TYPE$file > $SOURCE_FOLDER$TYPE`echo $file | awk -F '.hex' '{print $1}'`$EXTENSION
rm $SOURCE_FOLDER$TYPE$file
done
T="$(($(date +%s)-T))"
echo "Time in seconds: ${T}"
echo "process finished!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment