Created
April 9, 2020 00:31
-
-
Save dark452/69470ca97a4493bb835f9c8ae22b1650 to your computer and use it in GitHub Desktop.
Transform all the hex files stored in a folder to pdf
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
#!/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