Skip to content

Instantly share code, notes, and snippets.

@yosmoc
Created January 3, 2015 04:57
Show Gist options
  • Select an option

  • Save yosmoc/5e035b0185bb26e7c16e to your computer and use it in GitHub Desktop.

Select an option

Save yosmoc/5e035b0185bb26e7c16e to your computer and use it in GitHub Desktop.
シェルスクリプトでスペースや改行が入っているファイル処理するときには、IFSを設定する。 ref: http://qiita.com/samurai20000@github/items/7162d9bf7410b09cb5c2
#!/bin/bash
IFS=$'\n'
files=$(find . -type f -name "*.mp4")
for file in $files
do
file_without_extension=${file%.*}
echo "change from "${file}" to "${file_without_extension}.mp3
ffmpeg -i $file -acodec libmp3lame -ab 64k -ac 1 ${file_without_extension}.mp3
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment