How to print all files from a directory with lpr? - BSD

This is a discussion on How to print all files from a directory with lpr? - BSD ; I feel dumb asking this, because there's probably a really really simple solution. However, this has been driving me nuts all morning. How do I print all the files of type *.pdf from a directory using lpr? I tried "lpr ...

+ Reply to Thread
Results 1 to 15 of 15

Thread: How to print all files from a directory with lpr?

  1. How to print all files from a directory with lpr?

    I feel dumb asking this, because there's probably a really really
    simple solution. However, this has been driving me nuts all morning.

    How do I print all the files of type *.pdf from a directory using lpr?

    I tried "lpr *.pdf", but that just prints the first file.

    I tried a little bash script of

    for a in *.pdf
    do
    lpr "$a"
    done


    I tried that with and without the quotes, and that doesn't work
    either. I give up and yield to the deeper knowledge of the group.
    Ideas?

    --
    J'm Sm'th
    Where there's smoke, there's incomplete combustion.

  2. Re: How to print all files from a directory with lpr?

    On Fri, 27 Jul 2007 17:16:55 GMT, jim wrote:
    : I feel dumb asking this, because there's probably a really really
    : simple solution. However, this has been driving me nuts all morning.
    :
    : How do I print all the files of type *.pdf from a directory using lpr?
    :
    : I tried "lpr *.pdf", but that just prints the first file.
    :
    : I tried a little bash script of
    :
    : for a in *.pdf
    : do
    : lpr "$a"
    : done
    :
    :
    : I tried that with and without the quotes, and that doesn't work
    : either. I give up and yield to the deeper knowledge of the group.
    : Ideas?
    :

    It doesn't work with lpr and just one file, does it? If you're lucky
    enough to have a printer that can handle native .pdf then lpr *.pdf
    should do it (?)

  3. Re: How to print all files from a directory with lpr?

    On Fri, 27 Jul 2007 17:36:24 GMT, Howard Goldstein wrote:
    : On Fri, 27 Jul 2007 17:16:55 GMT, jim wrote:
    : : I feel dumb asking this, because there's probably a really really
    : : simple solution. However, this has been driving me nuts all morning.
    : :
    : : How do I print all the files of type *.pdf from a directory using lpr?
    : :
    : : I tried "lpr *.pdf", but that just prints the first file.
    : :
    : : I tried a little bash script of
    : :
    : : for a in *.pdf
    : : do
    : : lpr "$a"
    : : done
    : :
    : :
    : : I tried that with and without the quotes, and that doesn't work
    : : either. I give up and yield to the deeper knowledge of the group.
    : : Ideas?
    : :
    :
    : It doesn't work with lpr and just one file, does it? If you're lucky
    : enough to have a printer that can handle native .pdf then lpr *.pdf
    : should do it (?)

    Nevermind, I should have read what you wrote.

    You can do something like

    find . -name '*.pdf' -exec lpr {}\;

    although why lpr isn't dealing with it, I dunno. Zillions of files?

  4. Re: How to print all files from a directory with lpr?

    On Fri, 27 Jul 2007 17:37:28 GMT, Howard Goldstein wrote:
    : On Fri, 27 Jul 2007 17:36:24 GMT, Howard Goldstein wrote:
    : : On Fri, 27 Jul 2007 17:16:55 GMT, jim wrote:
    : : : I feel dumb asking this, because there's probably a really really
    : : : simple solution. However, this has been driving me nuts all morning.
    : : :
    : : : How do I print all the files of type *.pdf from a directory using lpr?
    : : :
    : : : I tried "lpr *.pdf", but that just prints the first file.
    : : :
    : : : I tried a little bash script of
    : : :
    : : : for a in *.pdf
    : : : do
    : : : lpr "$a"
    : : : done
    : : :
    : : :
    : : : I tried that with and without the quotes, and that doesn't work
    : : : either. I give up and yield to the deeper knowledge of the group.
    : : : Ideas?
    : : :
    : :
    : : It doesn't work with lpr and just one file, does it? If you're lucky
    : : enough to have a printer that can handle native .pdf then lpr *.pdf
    : : should do it (?)
    :
    : Nevermind, I should have read what you wrote.
    :
    : You can do something like
    :
    : find . -name '*.pdf' -exec lpr {}\;

    blugh, that'll descend and print out your subdirs too.

    for x in `ls *.pdf`; do lpr $x; done is another way

    There must be a zillion ways to do it, xargs with some options surely?


  5. Re: How to print all files from a directory with lpr?

    On 2007-07-27, Howard Goldstein scribbled these
    curious markings:
    > blugh, that'll descend and print out your subdirs too.
    >
    > for x in `ls *.pdf`; do lpr $x; done is another way


    apply 'lpr %1' *.pdf

    Nice shell-independent method. Those Linuxers don't know what they're
    missing... (I've yet to see a Linux system with apply(1)).

    Best Regards,
    Christopher Nehren
    --
    Yaakov, And it seems to me that the only people going on about
    "freedom" these days are RMS and Bush.

  6. Re: How to print all files from a directory with lpr?

    On Fri, 27 Jul 2007 19:21:50 GMT
    Christopher Nehren wrote:

    > apply 'lpr %1' *.pdf
    >
    > Nice shell-independent method. Those Linuxers don't know what they're
    > missing... (I've yet to see a Linux system with apply(1)).


    Bzzzt. Prints the first file, and that's it [which is the same
    behavior as "lpr *.pdf" and my little script. Could it be something in
    printcap?

    --
    J'm Sm'th

  7. Re: How to print all files from a directory with lpr?

    Christopher Nehren wrote:
    > apply 'lpr %1' *.pdf
    >
    > Nice shell-independent method. Those Linuxers don't know what they're
    > missing... (I've yet to see a Linux system with apply(1)).


    Ahhh... I didn't know about apply. Very useful.
    Thanks for the hint.
    --
    Torfinn Ingolfsen,
    Norway

  8. Re: How to print all files from a directory with lpr?

    In article <20070727145657.28bbac3a@shirley2>
    jim writes:
    >On Fri, 27 Jul 2007 19:21:50 GMT
    >Christopher Nehren wrote:
    >
    >> apply 'lpr %1' *.pdf
    >>
    >> Nice shell-independent method. Those Linuxers don't know what they're
    >> missing... (I've yet to see a Linux system with apply(1)).

    >
    >Bzzzt. Prints the first file, and that's it [which is the same
    >behavior as "lpr *.pdf" and my little script. Could it be something in
    >printcap?


    Both apply and your script should iterate.

    Not to ask the dumb questions, but have you confirmed (say, 'ls
    *.pdf') that you are dealing with multiple files? If they are
    downloaded, any mixture of case could be possible (as with other
    annoying things like names ending with spaces).


    --
    Drew Lawson | Radioactive cats have
    drew@furrfu.com | 18 half-lives
    http://www.furrfu.com/ |

  9. Re: How to print all files from a directory with lpr?

    On Fri, 27 Jul 2007 21:12:31 GMT
    drew@furrfu.com (Drew Lawson) wrote:

    > In article <20070727145657.28bbac3a@shirley2>
    > jim writes:
    > >On Fri, 27 Jul 2007 19:21:50 GMT
    > >Christopher Nehren wrote:
    > >
    > >> apply 'lpr %1' *.pdf
    > >>
    > >> Nice shell-independent method. Those Linuxers don't know what
    > >> they're missing... (I've yet to see a Linux system with apply(1)).

    > >
    > >Bzzzt. Prints the first file, and that's it [which is the same
    > >behavior as "lpr *.pdf" and my little script. Could it be something
    > >in printcap?

    >
    > Both apply and your script should iterate.
    >
    > Not to ask the dumb questions, but have you confirmed (say, 'ls
    > *.pdf') that you are dealing with multiple files? If they are
    > downloaded, any mixture of case could be possible (as with other
    > annoying things like names ending with spaces).


    I run "ls *.pdf" and I see all the files on stdout. I run "ls *.pdf |
    wc" and it tells me that there are 43 of them.


    --
    J'm Sm'th

  10. Re: How to print all files from a directory with lpr?

    On Fri, 27 Jul 2007 21:47:01 UTC, jim
    wrote:

    > On Fri, 27 Jul 2007 21:12:31 GMT
    > drew@furrfu.com (Drew Lawson) wrote:
    >
    > > In article <20070727145657.28bbac3a@shirley2>
    > > jim writes:
    > > >On Fri, 27 Jul 2007 19:21:50 GMT
    > > >Christopher Nehren wrote:
    > > >
    > > >> apply 'lpr %1' *.pdf
    > > >>
    > > >> Nice shell-independent method. Those Linuxers don't know what
    > > >> they're missing... (I've yet to see a Linux system with apply(1)).
    > > >
    > > >Bzzzt. Prints the first file, and that's it [which is the same
    > > >behavior as "lpr *.pdf" and my little script. Could it be something
    > > >in printcap?

    > >
    > > Both apply and your script should iterate.
    > >
    > > Not to ask the dumb questions, but have you confirmed (say, 'ls
    > > *.pdf') that you are dealing with multiple files? If they are
    > > downloaded, any mixture of case could be possible (as with other
    > > annoying things like names ending with spaces).

    >
    > I run "ls *.pdf" and I see all the files on stdout. I run "ls *.pdf |
    > wc" and it tells me that there are 43 of them.


    Do you have a broken filter in printcap that is doing something funny?

    --
    Bob Eager
    begin 123 a new life...take up Extreme Ironing!

  11. Re: How to print all files from a directory with lpr?

    On 27 Jul 2007 22:08:52 GMT
    "Bob Eager" wrote:

    > > I run "ls *.pdf" and I see all the files on stdout. I run "ls
    > > *.pdf | wc" and it tells me that there are 43 of them.

    >
    > Do you have a broken filter in printcap that is doing something funny?


    It's apsfilter. I'll detail it here:

    lp|canon_q|ljet4d;r=1200x1200;q=high;c=full;p=lett er;m=raw:\
    :rm=iR5570:\
    :rp=lp:\
    :if=/usr/local/etc/apsfilter/basedir/bin/apsfilter:\
    :sd=/var/spool/lpd/canon_q:\
    :lf=/var/spool/lpd/canon_q/log:\
    :af=/var/spool/lpd/canon_q/acct:\
    :mx#0:\
    :sf:\
    :sh:


    That's it.

    --
    J'm Sm'th

  12. Re: How to print all files from a directory with lpr?

    On Fri, 27 Jul 2007 22:23:40 UTC, jim
    wrote:

    > On 27 Jul 2007 22:08:52 GMT
    > "Bob Eager" wrote:
    >
    > > > I run "ls *.pdf" and I see all the files on stdout. I run "ls
    > > > *.pdf | wc" and it tells me that there are 43 of them.

    > >
    > > Do you have a broken filter in printcap that is doing something funny?

    >
    > It's apsfilter. I'll detail it here:
    >
    > lp|canon_q|ljet4d;r=1200x1200;q=high;c=full;p=lett er;m=raw:\
    > :rm=iR5570:\
    > :rp=lp:\
    > :if=/usr/local/etc/apsfilter/basedir/bin/apsfilter:\
    > :sd=/var/spool/lpd/canon_q:\
    > :lf=/var/spool/lpd/canon_q/log:\
    > :af=/var/spool/lpd/canon_q/acct:\
    > :mx#0:\
    > :sf:\
    > :sh:


    Looks OK. Is there anything useful in the log files?

    Oh, is there enough space on /var for all the spool files? Perhaps try:

    lpr -s *.pdf

    and see if that works.

    --
    Bob Eager
    begin 123 a new life...take up Extreme Ironing!

  13. Re: How to print all files from a directory with lpr?

    On Fri, 27 Jul 2007 19:21:50 GMT, Christopher Nehren wrote:
    : On 2007-07-27, Howard Goldstein scribbled these
    : curious markings:
    : > blugh, that'll descend and print out your subdirs too.
    : >
    : > for x in `ls *.pdf`; do lpr $x; done is another way
    :
    : apply 'lpr %1' *.pdf
    :
    : Nice shell-independent method. Those Linuxers don't know what they're
    : missing... (I've yet to see a Linux system with apply(1)).

    Cool! I never ran into apply before. Thanks

  14. Re: How to print all files from a directory with lpr?

    On 27 Jul 2007 22:33:52 GMT
    "Bob Eager" wrote:

    > On Fri, 27 Jul 2007 22:23:40 UTC, jim
    > wrote:
    >
    > > On 27 Jul 2007 22:08:52 GMT
    > > "Bob Eager" wrote:
    > >
    > > > > I run "ls *.pdf" and I see all the files on stdout. I run "ls
    > > > > *.pdf | wc" and it tells me that there are 43 of them.
    > > >
    > > > Do you have a broken filter in printcap that is doing something
    > > > funny?

    > >
    > > It's apsfilter. I'll detail it here:
    > >
    > > lp|canon_q|ljet4d;r=1200x1200;q=high;c=full;p=lett er;m=raw:\
    > > :rm=iR5570:\
    > > :rp=lp:\
    > > :if=/usr/local/etc/apsfilter/basedir/bin/apsfilter:\
    > > :sd=/var/spool/lpd/canon_q:\
    > > :lf=/var/spool/lpd/canon_q/log:\
    > > :af=/var/spool/lpd/canon_q/acct:\
    > > :mx#0:\
    > > :sf:\
    > > :sh:

    >
    > Looks OK. Is there anything useful in the log files?
    >
    > Oh, is there enough space on /var for all the spool files? Perhaps
    > try:
    >
    > lpr -s *.pdf
    >
    > and see if that works.
    >


    That did it! [the "lpr -s *.pdf"] I would have never thought the
    symbolic link switch would be the answer. Thanks for the help!

    --
    Jim Smith

  15. Re: How to print all files from a directory with lpr?

    On Wed, 15 Aug 2007 15:01:45 UTC, jim
    wrote:

    > That did it! [the "lpr -s *.pdf"] I would have never thought the
    > symbolic link switch would be the answer. Thanks for the help!


    Learned that long ago on a very early UNIX with not much disk space...!
    --
    Bob Eager


+ Reply to Thread