3
3

More than 5 years have passed since last update.

Macの複数のExcel(xlsx)ファイルをunzipでファイル名でディレクトリを作成しながら一括解凍する。そして写真を収集する。

Last updated at Posted at 2015-06-07

xlsxファイルから写真だけを抽出するときに使いました。

実行したディレクトリ配下のファイルをunzipする。
unzip -dオプションでファイル名(拡張子を外す)をディレクトリに指定して解凍する。

mvコマンドを使うのでバックアップをおすすめします。

1.terminalを開く。
2.mvコマンドでxlsxからzipに変換する。

mvコマンド
$cd /xlsxがあるディレクトリ
$for file in *.JPEG; do
> mv $file ${file%.xlsx}.zip;
> done

3.以下を実行して解答する。

unzipコマンド
$ for filename in $(ls) ; do unzip $filename -d ${filename%.*}; done

これでxlsxファイルがフォルダになります。
私は写真管理ソフト(Macの場合は写真.app)でこれらのフォルダ配下の写真を収集しました。

bash初心者でループ処理とか覚えてない人の手助けになれば。

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