Skip to content

Instantly share code, notes, and snippets.

@DMeechan
Last active November 30, 2019 23:38
Show Gist options
  • Save DMeechan/548bf809d2b9618abbf0c93aed4c2d3b to your computer and use it in GitHub Desktop.
Save DMeechan/548bf809d2b9618abbf0c93aed4c2d3b to your computer and use it in GitHub Desktop.
Renaming video files with bash

Bulk rename videos like this:

20191109_212029.mp4 (in the format: yearMonthDay_hourMinuteSecond)

to:

2019-11-09_21-20-29.mp4 (year-month-day_hour-minute-second)

By running this bash command:

for file in ./*.mp4; do mv "$file" "${file:0:6}-${file:6:2}-${file:8:5}-${file:13:2}-${file:15}" ; done

Created with help from this stackoverflow post: link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment