Want more features on Pastebin? Sign Up, it's FREE!
Guest

photo_thumbCheckExist.sh

By: phillips321 on May 9th, 2011  |  syntax: Bash  |  size: 0.87 KB  |  views: 189  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/bash
  2.  
  3. # ce script verifie si l'image cible a deja des miniatures
  4.  
  5. # input
  6. picDir=$1
  7. picName=$2
  8.  
  9. # fichiers temporaires
  10. fileTmpLs="/tmp/thbExist918ls"
  11. fileTmpRef="/tmp/thbExist918ref"
  12. fileTmpDiff="/tmp/thbExist918diff"
  13.  
  14.  
  15. # reference "ls"
  16. echo "SYNOPHOTO:THUMB_B.jpg" > $fileTmpRef
  17. echo "SYNOPHOTO:THUMB_L.jpg" >> $fileTmpRef
  18. echo "SYNOPHOTO:THUMB_M.jpg" >> $fileTmpRef
  19. echo "SYNOPHOTO:THUMB_S.jpg" >> $fileTmpRef
  20. echo "SYNOPHOTO:THUMB_XL.jpg">> $fileTmpRef
  21.  
  22. # "ls" cible
  23. if [[ -d "$picDir/@eaDir/$picName" ]]
  24. then
  25.   # echo "existe!"
  26.  
  27.   # verifie si les fichiers thumb existe bien tous
  28.   ls "$picDir""/@eaDir/""$picName" > $fileTmpLs
  29.   diff $fileTmpLs $fileTmpRef > $fileTmpDiff
  30.  
  31.   # else
  32.   # echo "n'existe pas"
  33.  
  34. else
  35.  
  36.   # met n'importe quoi pour dans le diff pour dire que ├ža differe
  37.   echo "n'existe pas donc a creer" > $fileTmpDiff
  38. fi
clone this paste RAW Paste Data