Skip to content
Browse files

Format code, remove 'sleep' calls, and remove direct reference to nam…

…e of script
  • Loading branch information...
1 parent c195914 commit c114a5efeddd189d4782f0ac823799c84506effc @eoghanmurray committed Jun 2, 2011
Showing with 28 additions and 55 deletions.
  1. +28 −55 MakeThumbs.sh
View
83 MakeThumbs.sh
@@ -1,62 +1,35 @@
-
-
-
-
#!/bin/bash
#set -x
-
Filename="$1"
-allfiles="$2"
+echo '$0 - create thumbnails of pdfs, requires ImageMagick'
if [ -n "$Filename" ]
then
-
-echo 'This file creates thumbnails of pdfs'
-
-
-
-
-if [ -n "$allfiles" ]
-then
-echo "Now processing all documents in directory"
-sleep 1
-# -------------------- All Files -----------------------------------
-
-
-find . -name "*.pdf" -print0 | while read -d $'\0' file
-do
-#echo "$file"
-TMPNAME=${file/.pdf/}
-JPGNAME=$TMPNAME.jpg
-echo 'creating ' $JPGNAME
-/usr/bin/convert -thumbnail 200x "$file[0]" "$JPGNAME"
-done
-
-
-
-
-
-# -------------------- One File -----------------------------------
+ if [ $Filename == '.' ]
+ then
+ echo "Now processing all documents in directory"
+ # -------------------- All Files -----------------------------------
+
+ find . -name "*.pdf" -print0 | while read -d $'\0' file
+ do
+ #echo "$file"
+ TMPNAME=${file/.pdf/}
+ JPGNAME=$TMPNAME.jpg
+ echo 'creating ' $JPGNAME
+ /usr/bin/convert -thumbnail 200x "$file[0]" "$JPGNAME"
+ done
+ else
+ # -------------------- One File -----------------------------------
+ echo 'Note: enter two words to process all files in the directory e.g. $0 1 2'
+ echo 'Now processing the single file ' $Filename
+ TMPNAME=${Filename/.pdf/}
+ JPGNAME=$TMPNAME.jpg
+ convert -thumbnail 200x "$Filename"[0] "$JPGNAME"
+ echo 'Creating ' $JPGNAME
+ exit 1
+ fi
else
-
-
-sleep 2
-echo 'Note: enter two words to process all files in the directory e.g. MakeThumbs 1 2'
-sleep 2
-echo 'Now processing the single file ' $Filename
-TMPNAME=${Filename/.pdf/}
-JPGNAME=$TMPNAME.jpg
-convert -thumbnail 200x "$Filename"[0] "$JPGNAME"
-echo 'Creating ' $JPGNAME
-exit 1
-fi
-
-else
-echo 'Program to get thumbnails'
-echo 'Nothing entered'
-echo 'Enter a single filename, or any two words to process all files e.g. MakeThumbs 1 2'
-sleep 2
-exit 1
-
-
-
+ echo 'Nothing entered'
+ echo "$0 my_file.pdf to process a single file"
+ echo "$0 . to process all files in this directory"
+ exit 1
fi

0 comments on commit c114a5e

Please sign in to comment.
Something went wrong with that request. Please try again.