0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Macでフォルダの中にある画像を一括で ".eps" にするシェル置いときます

Last updated at Posted at 2019-01-30

はじめに

Macで任意のフォルダの中にある画像の拡張子を全てepsに変換するシェル作ったので置いときます
卒論とか修論とかで使えるのではないでしょうか

現状のフォルダ構成

カレントディレクトリに convert.shファイル および images フォルダを作成してください
imagesフォルダの中には,変換したい画像を全て入れてください

Macにconvertコマンドをインストール

以下を,参考にしてみてください.
https://qiita.com/sowd/items/832594dd22d99aebc8a2

シェルスクリプト作成

convert.sh
for file in `\find ./images -maxdepth 1 -type f`; do
    # 元のファイルを取り出す(拡張子なし)
    before_image="${file%.*}"
    before_image="${before_image}."
    # 元のファイルの拡張子を取り出す
    before_image_extend="${file##*.}"
    # convert
    after_image="${before_image}eps"
    convert $before_image$before_image_extend $after_image
done

実行

$ chmod 755 convert.sh
$ ./convert.sh

終わりに

もっとこうすればいいのではないかなどの,アドバイスよろしかったらお願いします.
お聞き下さいましてありがとうございました.:sunny:

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?