DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 12th December 2008
gosha gosha is offline
Spam Deminer
 
Join Date: Jun 2008
Location: China
Posts: 256
Default djvu conversion (c44) command

Hello folks!
I know my question will seem trivial to a programmer, but please help.
I have a lot of .jpg files in a directory, and need to convert them to .djvu format.
The c44 command doesn't seem to accept wildcards eg.: "c44 *", you can only write the actual file name one by one to have them converted.
Since I have nearly 300 files, it is quite inconvenient.
What would a small script that will do the job look like?

thank you
Reply With Quote
  #2   (View Single Post)  
Old 12th December 2008
bsddaemon bsddaemon is offline
Slack Daemon
 
Join Date: Oct 2008
Posts: 35
Default

Code:
for img_file in *.jpg; do
    echo $img_file
done
__________________
...then the God created man...
Reply With Quote
  #3   (View Single Post)  
Old 12th December 2008
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 1,027
Default

I'm not familiar with c44 in particular, but it sounds
like you may want something like this?:
Code:
#!/bin/sh
for FILE in $* ; do
  c44 $FILE
done
Reply With Quote
  #4   (View Single Post)  
Old 12th December 2008
bsddaemon bsddaemon is offline
Slack Daemon
 
Join Date: Oct 2008
Posts: 35
Default

For loop would be the easiest solution, or maybe you wanna have some fun with find and xargs:

Code:
 $ find dir -name "*.jpg*" -exec convert_to_djvu_cmd {} \;
Code:
 $ find dir -name "*.jpg*" | xargs convert_to_djvu_cmd
__________________
...then the God created man...
Reply With Quote
  #5   (View Single Post)  
Old 12th December 2008
gosha gosha is offline
Spam Deminer
 
Join Date: Jun 2008
Location: China
Posts: 256
Default

thank you for you quick answer!
The "-exec" variant worked with errors, the "xargs" variant did not work
The "for" variant worked without errors with a small change:
for FILE in * ; do c44 $FILE ; done

thanks a lot
Reply With Quote
  #6   (View Single Post)  
Old 12th December 2008
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,125
Default

You can redirect the output of the following sed command to file
Code:
$ ls *jpg | sed -e 's/^/c44 /'   
c44 100_0574.jpg
c44 I_am_hungry.jpg
c44 dweilen.jpg
Then feed it to the shell for execution
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to modify the ls command? bsdnewbie999 OpenBSD General 9 16th May 2009 08:20 AM
Delayed command? wubrgamer Other BSD and UNIX/UNIX-like 9 22nd April 2009 03:15 AM
avidemux2 command line roddierod FreeBSD General 1 10th November 2008 08:27 PM
pkg-get command not found whispersGhost Solaris 2 11th June 2008 01:06 PM
crypt command whispersGhost Solaris 3 9th June 2008 05:37 AM


All times are GMT. The time now is 09:23 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick