0

This is the code I think I need help with:
find . -name "*.png" -exec mv "{}" ./"$1"-dir \;

Using pdftohtml in a bash function to get a whole bunch of pdf's (thousands) put into their own folders.

Unfortunately, pdftohtml saves the images in the same folder as the group of pdfs. I'm close now but need help moving all the .pngs into the right folder.

This code for some reason saves all the pdf images in only the last folder created.

  #!/bin/bash
  function pdf2html {
    pdftohtml -c -noframes $1 "$1".html
    mkdir $1-dir
    find . -name "*.png" -exec mv "{}" ./"$1"-dir \;
    mv "$1".html "$1"-dir/"$1".html
  }

  for f in *.pdf
  do
    echo $f
    pdf2html $f
  done

Thanks for your attention!

irth
  • 1,696
  • 2
  • 15
  • 24
  • turn on shell debugging/trace with `set -vx` (inside the function too) to see what is happening. Good luck. – shellter Jan 29 '15 at 04:50
  • I found a better solution in https://github.com/coolwanglu/pdf2htmlEX but this question might help someone else still. – irth Jan 29 '15 at 05:12
  • @shellter thanks for the debug tip and cheers for wish of luck.doesn't seem to explain exactly waht's up tho. think maybe the *.png is looking for all png's and scraping them from the priorly made folders. – irth Jan 29 '15 at 07:47

0 Answers0