1
1

More than 5 years have passed since last update.

mozjpegをgnu parallelで並列に実行

Posted at
cmoz.sh
#!/bin/bash
from="a/"
to="b/"
ex="*.png"
find $from -name $ex | parallel -j+0 "cjpeg -outfile $to{/.}.jpg {}"

gnu parallel

-j+0: 最大論理コア数で実行
{}: パイプでもらった引数(ex. a/001.png)
{/.}: パイプからもらった引数をファイル名だけにして(/)さらに拡張子も取る(.)(ex. 001)

そのた

Q. print0とかつけなくていいの?
A. よい。ユニコードだろうがスペースだろうが突っ込めば思ったとおりに'\n'デリミタで動いてくれる。parallelもcjpegも良い子。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1