This time I want to introduce you a very easy way to print every file inside a folder directly from the Terminal in a Linux/UNIX system:
The command is called lpr and here is a short definition of it provided from http://linux.about.com/:
NAME
lpr - print files
SYNOPSIS
lpr [ -E ] [ -P destination ] [ -# num-copies [ -l ] [ -o option ] [ -p] [ -r ] [ -C/J/T title ] [ file(s) ]
DESCRIPTION
lpr submits files for printing. Files named on the command line are sent to the named printer (or the system default destination if no destination is specified). If no files are listed on the command-line lpr reads the print file from the standard input.
OPTIONS
The following options are recognized by lpr:
-E
Forces encryption when connecting to the server.
-P destination
Prints files to the named printer.
-# copies
Sets the number of copies to print from 1 to 100.
-C name
Sets the job name.
-J name
Sets the job name.
-T name
Sets the job name.
-l
Specifies that the print file is already formatted for the destination and should be sent without filtering. This option is equivalent to "-oraw".
-o option
Sets a job option.
-p
Specifies that the print file should be formatted with a shaded header with the date, time, job name, and page number. This option is equivalent to "-oprettyprint" and is only useful when printing text files.
-r
Specifies that the named print files should be deleted after printing them.
#####################
So, here is a little example using the lpr command:
Lets suppose, that we have 229 PDFs files inside a folder and we want to print them all obviously without the need to open each of them, then click "File" then "Print", select the number of copies and finally click PRINT.
Just imagine the amounts of time that that will requires if we do it manually, so we will do something much better with just one line of text inside a Terminal ;)
NOTE: If you want to export your files (the ones that are supported by OpenOffice like *.doc, *ppt, *.odp, *odt and so on) we can use another Linux/UNIX program called UNOCONV and in a past post I teach you in a simple way how to use it.
The best command that satisfies my needs is the next one:
Explanation:
-o landscape = means that inside the parameters of the printing, I specifies that every file must be printed in a landscape way.
-P Photosmart-C5200-series = means that I specifies to the command, that the printer that I want to use is Photosmart-C5200-series ( I recommend you to be sure about this parameter to avoid sending 10,000 files to an undesired printer device).
*.pdf = means that every PDF file inside the folder will be printed (You know, this can be changed to *.odt (to print every OpenOffice Writer Text file and so on).
Hope this entry will help someone ;)
Benjamin
The command is called lpr and here is a short definition of it provided from http://linux.about.com/:
NAME
lpr - print files
SYNOPSIS
lpr [ -E ] [ -P destination ] [ -# num-copies [ -l ] [ -o option ] [ -p] [ -r ] [ -C/J/T title ] [ file(s) ]
DESCRIPTION
lpr submits files for printing. Files named on the command line are sent to the named printer (or the system default destination if no destination is specified). If no files are listed on the command-line lpr reads the print file from the standard input.
OPTIONS
The following options are recognized by lpr:
-E
Forces encryption when connecting to the server.
-P destination
Prints files to the named printer.
-# copies
Sets the number of copies to print from 1 to 100.
-C name
Sets the job name.
-J name
Sets the job name.
-T name
Sets the job name.
-l
Specifies that the print file is already formatted for the destination and should be sent without filtering. This option is equivalent to "-oraw".
-o option
Sets a job option.
-p
Specifies that the print file should be formatted with a shaded header with the date, time, job name, and page number. This option is equivalent to "-oprettyprint" and is only useful when printing text files.
-r
Specifies that the named print files should be deleted after printing them.
#####################
So, here is a little example using the lpr command:
Lets suppose, that we have 229 PDFs files inside a folder and we want to print them all obviously without the need to open each of them, then click "File" then "Print", select the number of copies and finally click PRINT.
Just imagine the amounts of time that that will requires if we do it manually, so we will do something much better with just one line of text inside a Terminal ;)
NOTE: If you want to export your files (the ones that are supported by OpenOffice like *.doc, *ppt, *.odp, *odt and so on) we can use another Linux/UNIX program called UNOCONV and in a past post I teach you in a simple way how to use it.
Folder with many PDFs file of the example
$ lpr -o landscape -s -P Photosmart-C5200-series *.pdf
Explanation:
-o landscape = means that inside the parameters of the printing, I specifies that every file must be printed in a landscape way.
-P Photosmart-C5200-series = means that I specifies to the command, that the printer that I want to use is Photosmart-C5200-series ( I recommend you to be sure about this parameter to avoid sending 10,000 files to an undesired printer device).
*.pdf = means that every PDF file inside the folder will be printed (You know, this can be changed to *.odt (to print every OpenOffice Writer Text file and so on).
Here is a screenshot of my Terminal inside that folder with the whole command typed in:
Hope this entry will help someone ;)
Benjamin