Results 1 to 2 of 2
Hi,
I would like to create/find a bash script that batches all the PDF files in a folder and rename the combined PDF file as the folder name (And also ...
- 08-01-2011 #1Just Joined!
- Join Date
- Aug 2011
- Posts
- 2
Batch PDF Script
Hi,
I would like to create/find a bash script that batches all the PDF files in a folder and rename the combined PDF file as the folder name (And also do the sub-folder recursively the same way).
I know that you can do this by PDFTK or GhostScript, however I'm new to bash scripting.
Can anyone help please?
Thanks & Regards,
blivori
- 08-01-2011 #2Just Joined!
- Join Date
- Aug 2011
- Posts
- 2
i was trying to create a few lines that would recursively search for any pdf files in a folder and it's subfolders and add those files to an array - but it's not working (ignoring the directory paths)
Any help please?
Code:#!/bin/bash SEARCHDIR=/home/user/search_directory DESTDIR=/home/user/destination_directory EXT=pdf files=() file=0 for EXT in ${EXTS[@]} do COUNTER=0 for file in $( find $SEARCHDIR -name "*.$EXT" -type f ) do BASENAME=$(basename $file .$EXT) FILENAME=$BASENAME while [ -e ${DESTDIR}/${FILENAME}.$EXT ] do COUNTER=$[$COUNTER+1] FILENAME=${BASENAME}${COUNTER} FILENAME=$file done done done files = (echo "$file") files = $[$files++] echo $files


Reply With Quote