Renaming GoPro Files

GoPro cameras are popular among adventure-seekers, athletes, and outdoor enthusiasts. They’re rugged, versatile, and capable of capturing stunning video and photos. However, one thing that can be frustrating for many GoPro users is the camera’s file naming convention.

By default, GoPro cameras use a file naming convention that includes a sequence of numbers, such as “GOPR1234.MP4”. While this might be useful for keeping track of the order in which the files were recorded, it can make it difficult to find and organize specific files. For example, if you’re looking for a specific video from a particular day or event, you would need to manually search through all the files to find it.

Fortunately, there is a solution to this problem: I’ve written a Python program that renames your GoPro files with a more descriptive name that includes the date and time the files were created. Here’s an example program that does just that:

					import os
import datetime


# Set the directory path where the files are located
directory_path = 'F:/Pranay/20230103_MP_Gujarat_wildlife/videos'

# Get the list of all files in the directory
file_list = os.listdir(directory_path)

# Loop through each file in the list
for file_name in file_list:
    file_path = os.path.join(directory_path, file_name)

    # Get the creation time of the file
    creation_time = os.path.getmtime(file_path)
    # Convert the creation time to a formatted date and time string
    date_time_str = datetime.datetime.fromtimestamp(creation_time).strftime('%Y_%m_%d_%H_%M_%S')
    # Create new file name
    new_file_name = "{}_{}.{}".format(date_time_str, FILE_PREFIX, file_name.split('.')[1])

    # Check if the new file name already exists
    if os.path.exists(os.path.join(directory_path, new_file_name)):
        i = 1
        while os.path.exists(os.path.join(directory_path, "{}_f{}_{}.{}".format(date_time_str, i, FILE_PREFIX, file_name.split('.')[1]))):
            i += 1
        new_file_name = "{}_f{}_{}.{}".format( date_time_str, i, FILE_PREFIX, file_name.split('.')[1])
    # Rename the file
    os.rename( file_path, os.path.join(directory_path, new_file_name))

This program can be used to rename all the files in a provided folder. There are two variables which a user need set in order to correctly execute the program.

FILE_PREFIX : Since I wrote the program to rename GoPro Files, I have set the value of this variable to ‘GoPro’. If you were to rename all the files of your Canon photos. You can set it to ‘Canon’

directory_path : User need to specify the path to the files that need to be renamed.


Following is the before and after example of a file.

Original name : GX010104.MP4

New name : 2023_01_05_18_06_47_GoPro.MP4


Rename syntax is YYYY_MM_DD_HH_MM_SS_<FILE_PREFIX>.<ext>

Leave a Reply

Pranay Meher

Full time cg/vfx artist / part time traveller, photographer and hobbyist

Hi, I’m Pranay. Welcome to my website. This is my space where I share my travel stories, my musical progress, photographs and some CG/VFX related stuff.

Pranay Meher

Subscribe to my Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 925 other subscribers