How to use Power Automate to systematically rename files


Use Power Automate to rename files text over vector image of a robot
Image: Mark W. Kaelin

Often when working in business, and sometimes in a personal situation as well, we will be asked to perform periodic, repetitive and routine computer-related tasks. These routines (copying files, renaming files, adding lines to spreadsheets, etc.) are often performed manually by users who eventually come to begrudge it as a waste of their valuable time. However, by automating those repetitive tasks, we can reduce frustration and greatly improve productivity.

SEE: The CIO’s guide to low-code platforms (TechRepublic Premium)

Power Automate, which is available for free to Microsoft Windows 11 users, can help automate repetitive tasks by providing a user-friendly platform for low-code solutions. This underused tool is also available to users running Windows 10, if they also happen to have a Microsoft 365 subscription. Power Automate is Microsoft’s anybody-can-use-it automation solution. It relies on drag-and-drop code building, and it is much more powerful than many users may understand or appreciate.

Use Power Automate to systematically rename files

With this brief tutorial, we will show you the basics of creating a workable Power Automate solution using its low-code building environment. For our example, we will create a solution that systematically renames a set of files in a folder, including subfolders, based on a set of parameters and variables we define by choosing from simple dropdown menus.

SEE: Research: Increased use of low-code/no-code platforms poses no threat to developers (TechRepublic Premium)

If you are running Windows 11, type power automate into the desktop search tool, and select it from the results to load Power Automate. If you are using Microsoft 365, you will have to log in to the Microsoft 365 website first and install the desktop version from there. If you have created and saved Power Automate solutions before, you will see them listed in the application dashboard, otherwise you will see this welcome greeting (Figure A).

Welcome message in Power Automate
Figure A

For our example, click + New Flow to start the building process. Give your new flow a descriptive name, and then, click Create to reach the main development screen, as shown in Figure B.

main development screen in Power Automate
Figure B

As you can see from the list of options available on the left-hand side of the screen, there are dozens of potential actions that can be taken when developing solutions in Power Automate.

For our example, we are going to rename a set of files located in a specific subfolder (Figure C). We are going to systematically add _2022 to the end of each file name using a software robot we create in Power Automate.

subfolder with items circled
Figure C

Since we will be working with a set of files in a folder, we will first need to access those folders, so we will start by expanding the Folders action item on the left-hand navigation bar. We will then drag and drop the Get Files In Folder item to the Subflow section, which will then display a dialog screen where we can define our variables (Figure D).

arrow pointing toward variable icon in Power Automate
Figure D

The first box allows us to define which folder we want to work with, so we click the folder icon and navigate to our example folder. The second box asks us to include a filter for our files, but for our example, we want to rename all files, so we leave the * as a wildcard filter for all files.

Since we are also going to apply our changes to subfolders, we will toggle that button to the on position.

Figure E shows us what this screen looks like filled in. Note that the output of this action will be a variable named Files, which was created by default. We could change that name if we wanted to, but it is okay as is for our purposes.

Filters menu in Power Automate
Figure E

Click Save to finish this part of the routine. Our software robot will now retrieve all the files from our designated folder and subfolders. The next step is to systematically rename those file names.

In the Actions navigation bar, expand Files and then drag and drop the Rename File(s) item to the Flow section below our previous routine, where you will be presented with another set of variable settings, as shown in Figure F.

Variable settings in Power Automate
Figure F

The first box is asking us which files we want to rename. This is where the power of automation and Power Automate comes in to play. We want to rename the files pulled in by the routine we defined in the previous step, so we click the variable icon ({x}) and select Files(Figure G).

variable icon circled in Power Automate
Figure G

In the next box (Figure H), we must decide which renaming scheme we are going to apply. For our example, we are going to add _2022 to the end of each file name and keep the extension as is.

Renaming configurations in Power Automate
Figure H

As you can see, we have opted to do nothing if we run across a file with a name that already exists. And, since we do not need the output for another step in our routine, we have decided not to produce another variable. Click Save when you are satisfied with your answers to the questions.

Our example software robot is now complete. Click  Run to start the automated routine, and then, check the results in our folders, as shown in Figure I.

Results of Power Automate application circled
Figure I

Of course, there are many tools available that can rename files; however, Power Automate is a robust, free, low-code tool can be used to automate tasks in an operating environment comprised of Windows, Microsoft 365 and Azure.

Power Automate can work with Word documents, Excel worksheets and other Microsoft software to help users update reports, modify documents, reply to emails and a multitude of other routine tasks. Power Automate is a currently underused tool, and users who wish to stand out from their peers should learn to use it.



Source link