Rename Files with Regex and directory_iterator

Learn to rename files with regex and directory_iterator.

We'll cover the following

This is a simple utility that renames files using regular expressions. It uses directory_iterator to find the files in a directory and fs::rename() to rename them.

How to do it

In this recipe, we create a file rename utility that uses regular expressions:

  • We start by defining a few convenience aliases:

Get hands-on with 1400+ tech skills courses.