My Science Is Better

29Apr/112

Nautilus Script – print all documents in folder

I had to print a lot of files lately and it became clear that opening each of them, then hitting ctrl + p takes too long, so i decided instead to look for a nautilus script that allows me to right click inside the folder and hit Print All. Since i didn't find anything (probably didn't look enough...) i built one myself.

Save the script bellow as "Print All Documents" then place it in ~/.gnome2/nautilus-scripts

#!/bin/bash

## By Romeo - Adrian Cioaba
## romeo.cioaba@spotonearth.com
## If you modify it, Please let me know.
## released under GPLv3

IFS=$'\n'

filenames=`ls`
for eachFile in $filenames
do
    case $eachFile in
        *.pdf) lpr "$eachFile"
        ;;
        *.doc) libreoffice -p "$eachFile"
        ;;
        *.docx) libreoffice -p  "$eachFile"
        ;;
        *.txt) lpr "$eachFile"
        ;;
        *.jpg) lpr "$eachFile"
        ;;
    esac
done

exit 0

Make it executable

chmod +x ~/.gnome2/nautilus-scripts/Print\ All\ Documents

and you are good to go. When you go inside a folder, right click and under the Scripts entry you will have the option "Print All Documents"

This script can be of course tweaked to print more file types.

Comments (2) Trackbacks (0)
  1. Thanks a lot !

    Just add Open Document files like *.odt to be perfect.

    Have a nice day.

  2. All of my qeustinos settled-thanks!


Leave a comment


No trackbacks yet.

Tag Cloud

Categories

Archives

Akismet

Blogroll

Ads