Created
June 28, 2021 03:44
-
-
Save musan6363/3bc3352919f59cb359b81914005c4f11 to your computer and use it in GitHub Desktop.
GoProの動画ファイル名を昇順で扱えるようにリネームする.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# GoProの動画ファイル名を昇順で扱えるようにリネームする. | |
# GH019999.MP4やGH029999.MP4といった動画がある. | |
# これらの動画は一つの動画が分割したもの. | |
# 下4桁が同じであれば同じ動画であることを表す. | |
# 上2桁が動画の順序. | |
# ファイル名順で並べるとかなり離れた位置に分かれてしまう. | |
# 一括でリネームしてファイルを扱いやすくする. | |
# カレントディレクトリ下のMP4を対象にする | |
for file in $(find . -name "*.MP4"); do | |
title=`basename ${file} .MP4` # 保存時のタイトル.パスや拡張子を抜く.ファイル名のみ | |
video_id=${title:4:4} # 9999の部分を取得.同じ動画であれば共通. | |
video_no=${title:2:2} # 01,02の部分を取得.動画の順番. | |
mv $file id${video_id}no${video_no}.mp4; # 出力結果processedを出力フォルダに移動 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment