I've slightly modified the code you gave me to add a little extra logic
in determining
when it should do the image conversion.  It will also remove a
cover.png file that
exists in the same folder that a cover.jpg is in, leaving just the .jpg
version.


Code:
--------------------
    
  #!/bin/sh
  
  traverse()
  {
  # Traverse a directory
  cd "$1"
  if [ -s "cover.png" ]; then
  if [ ! -s "cover.jpg" ]; then
  pngtopnm cover.png | pnmtojpeg > cover.jpg
  else
  /bin/rm -f cover.png
  fi
  fi
  ls | while read i
  do
  if [ -d "$i" ]; then
  echo "Directory: $i"
  # Calling this as a subshell means that when the called
  # function changes directory, it will not affect our
  # current working directory
  (traverse "$i" `expr $2 + 1`)
  fi
  done
  }
  
  if [ -z "$1" ]; then
  traverse . 0
  else
  traverse "$1" 0
  fi
--------------------


Thanks a lot for your pointer in this area as it seems to be working
well.
I am still curious, however, if this conversion should be necessary. 
Does
anyone have an opinion on this?


-- 
kyleki
------------------------------------------------------------------------
kyleki's Profile: http://forums.slimdevices.com/member.php?userid=2510
View this thread: http://forums.slimdevices.com/showthread.php?t=29105

_______________________________________________
discuss mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/discuss

Reply via email to