Re: Batch processing of JPEG images



On Tue, 20 Jun 2006 23:18:59 +0100, Bonge Boo! <bingbong@xxxxxxxxxxx>
wrote:

On 20/6/06 21:18, in article
00mg929lq19i2ht39846gudta238n71tft@xxxxxxxxxxxxxxxxxxxxxxx, "Jaimie
Vandenbergh" <jaimie@xxxxxxxxxxxxxxxxxxxxx> wrote:

Or if you're feeling geekie, I use imagemagick from the command line.

<Warning>Your weekend may disappear if you attempt this</Warning>

Yup.

And it doesn't work recursively either, so if you've got loadsasubfolders
don't try it.

Shirley you can fudge it into a `find -exec` command line?

Probably. But I'm lazy, and I'm usually doing a few folders with a few
hundred files in, so haven't been fussed to going looking. If tomorrow is
slack I might take a look.

Bash isn't my thing.

S'not bash, s'find. Which has a strange and special format all of it's
own, but it's ded gud.

Simple form, all one line:

find (filename matching regexp) -exec (command line you want to do to
each found file) {} \;

The {} is the placeholder where each filename is put as it's found.
The \; is an "end of -exec" marker, so you can put more terms after
it. Each term is processed in order, left to right:

eg

find "~/*.tmp" -exec rm {} \;

should be obvious, while the more involved

find "*.log" -size +1M -print -exec cp {} ~/biglogslivehere/ \;
-exec rm {} \;

finds all *.log files larger than 1meg, prints each filename to the
screen, then copies it to a folder, then deletes the original.

Note that each file is processed completely before the next one is
found, can be important.

The "-print" bit is very handy, to validate your regexp before you go
around -exec rm {}'ing things.

Cheers - Jaimie (who probably got the -size parameter wrong)
--
Happiness, n.: An agreeable sensation arising from contemplating the
misery of another. - Ambrose Bierce, The Devil's Dictionary
.



Relevant Pages

  • Re: Spaces in UNIX Filenames Bad
    ... In perl the solution was fairly easy but because of the way bash treats space characters the solution wasn't quite as obvious. ... expansion Bash performs on the text of a command, ...
    (comp.os.linux.misc)
  • Re: I have a question about bash period command
    ... I have a question about bash period command. ... I have this script, b.sh, which should run another script: ... i.e. add a relative path component ./ in front of the filename. ...
    (comp.unix.shell)
  • I have a question about bash period command
    ... I have a question about bash period command. ... I have this script, b.sh, which should run another script: ... Read and execute commands from the filename argument in the ...
    (comp.unix.shell)
  • Re: F11: Bug in sh-4.0 source build-in command
    ... source command. ... This is documented in the manpage. ... The bash builtinsmanpage states this fairly clearly: ... Read and execute commands from filename in the current shell ...
    (Fedora)
  • Re: USB neu starten
    ... PCI Interrupt Link enabled at IRQ 7 ... bash: SLPB: command not found ... bash: syntax error near unexpected token `supports' ... achim@achim:~$ ReiserFS: hdc5: found reiserfs format "3.6" with standard journal ...
    (de.comp.os.unix.linux.hardware)