---
title: 'FFMPEG Batch Processing Script to Rename All Files in Directory With a Glob or Pattern in Terminal'
source: 'https://youtube.com/watch?v=d-l5Pntdtbc'
video_id: 'd-l5Pntdtbc'
date: 2026-06-14
duration_sec: 154
---

# FFMPEG Batch Processing Script to Rename All Files in Directory With a Glob or Pattern in Terminal

> Source: [FFMPEG Batch Processing Script to Rename All Files in Directory With a Glob or Pattern in Terminal](https://youtube.com/watch?v=d-l5Pntdtbc)

## Summary

This video demonstrates a batch processing script that renames all files in a directory to a sequential pattern (e.g., image01, image02) for use with FFmpeg. The script is provided in the video description and can be modified to suit different naming patterns.

### Key Points

- **Introduction to the script** [0:00] — The video presents a batch processing script (rename.bat) that renames all files in a directory using a glob or pattern.
- **Example of renaming** [0:28] — The script renames image files to a sequential pattern like image01, image02, etc., which is useful for FFmpeg processing.
- **Executing the script** [1:00] — Running the script automatically renames every file in the directory to the specified pattern.
- **Script explanation** [1:40] — The script sets a counter, loops through files with extensions like JPG or PNG, and renames them to the pattern. Users can modify the pattern as needed.
- **Completion message** [2:13] — After renaming, the script displays 'rename complete' and pauses.

### Conclusion

The script provides a simple way to bulk rename files to a sequential pattern, which is particularly useful for FFmpeg workflows. The script is available in the video description.

## Transcript

Uh hello guys uh welcome to this video.
So in this video I will show you uh a
ffmpg batch processing script which will
actually rename all
your files with a glob or a pattern. So
let's suppose I have this uh rename.bat
file right here. So it's a batch
processing script. It will basically
rename all the files which are present
in this directory right here. You will
see with a pattern. So you will see we
have all these image files which are
present. So I just want to rename this
to a simple glob or a pattern like this
which is image 01 image
02. This pattern if you see this pattern
image 01 02 03 04 so in many situations
in FMPG you need these images in rename
in this pattern. So I've given this
script here in the description of this
video. So once you execute the script uh
let me just show you. So just need to
open this file. So it will automatically
rename every file in this directory. So
as soon as you do this you will
see the rename will complete here. You
will
see. So it has actually renamed every
file with a glob or pattern. It's a very
useful FMPPG batch processing script
guys. I've given the script in the
description of the video. So it will
actually rename every file with this
pattern. You will see
that. So let me guide through the script
here. It's a bat processing script. So
first of all we do this and we set count
is equal to one and then we loop through
basically providing the extension it can
be either JPG or PNG image and then we
actually rename this to this
pattern. You can change this pattern
once you get the script you can modify
this as well to whichever pattern or
glob pattern that you want to rename
your files. After that it displays the
message rename complete and pause. So
this is a simple image processing bat
processing script which does this rename
task uh bulk. Thank you very much for
watching this video and also check out
my website
freemediattools.com which contains
thousands of tools.
