Ask a Question
GoPro Support Hub Ask a question. Share an answer. Find a solution. Stay stoked.
Announcements
Is your GoPro gear up to date? Check to see If it is on our Update page.
Cameras
Reply
Sightseer
Posts: 1

Script for bulk renaming GoPro files.

[ New ]

Hi,

 

I want to share a script I created for bulk renaming the GoPro files to be shown in correct order in folder and applications.

 

The original naming convention is not very good as the file index is located in the middle of the filename and the sequence number is in the back of the filename, which is very unconvenient when working and viewing the files in different applications. Yes, sorting by date should solve the problem, but it doesn't work every time and in every application.

 

Original GoPro Camera File Naming Convention

https://gopro.com/help/articles/question_answer/GoPro-Camera-File-Naming-Convention

 

So here is the script, which exchanges the order of first 4 symbols of the filename with the last 4, for all the files in the folder. Including the *.thm and *.lrv. The script is reversible, so running it the second time in the same folder reverts the filenames back.

 

Just create a _script_.bat file, copy and run in the folder with GoPro files.

 

Code:

===

@echo off
echo.
echo Changing file number position in GoPro filenames
echo like this: GXXXYYYY*.* ^<-^> YYYYGXXX*.*
setlocal enabledelayedexpansion
echo.
for /f "delims= eol=:" %%f in ('dir /b /a-d G???????*.* ????G???*.*') do (
set filename=%%~nf
set firstfour=!filename:~0,4!
set secondfour=!filename:~4,4!
echo %%f ^> !secondfour!!firstfour!!filename:~8!%%~xf
ren %%f !secondfour!!firstfour!!filename:~8!%%~xf
)
echo.
echo Done.
pause

===

 

Enjoy!