You could do it this way:
inotifywait -m -e close_write ~/Pictures/webcam --format "%w%f" | \
while read filename; do lpr -P Photosmart-C5200-Series "$filename"; mv "$filename" ~/Pictures/webcam/printed; done
(part of the inotifytools
package) waits for writes to the folder. The '-m' flag makes it run indefinitely (instead of running it in a script loop which could mean it might miss an event). The '--format' outputs only the file names that were written.
The output of the inotify
is piped to a while loop (alternatively xargs
could be used to run a command for each filename input). The while loop reads the filename from standard input, prints it to the printer, and then moves it to the destination directory.
If you are using CUPS
for your printing, then there are some image processing options that can be specified if the default is not what you want.
(I noticed your question on the MLUG list, but hadn't had a chance to respond).