T02 - Rename all files in a folder |
Task Description |
Loop through all the files in the selected folder and rename files with .xls extension by prefixing it with today’s date.
T02.atmn
Note: Save the .atmn file in My Documents -> Automation Anywhere -> Automation Anywhere -> My Tasks
|
| Solutions |
 |
Create new task
- Click on Tools->Task Editor.
|

Screenshot 1

Screenshot 2

Screenshot 3

Screenshot 4
|
 |
Loop through folder
- From the commands list select "Conditions / Loops -> Loop” command.
- In the "Start Loop" wizard, select “Each file in a folder” option and specify the folder name.
- Save the command.
|
 |
Check if .xls extension
- Select “Conditions / Loops-> If” command.
- In the “If” wizard, select “Variable” option and select variable “Extension” (Click edit to select a variable).
- Select “Equal To” operator and enter a fix value “xls”.
- Save the command.
|
 |
Rename the file
- Select “Programs/Files/Windows->Files/Folders” Command.
- Select “Rename File(s)” option in “Files/Folder” wizard and enter the path of the folder. Press F2 Key to select Filename, Extension, Day, Month and Year System Variables and enter them as shown.
- Save the command.
- If needed adjust the “Rename File(s)” command between the “If” command using Up/Down buttons on the Toolbar.
|
|
When you run this task, it loops through all the files in the selected folder and rename files with .xls extension by
prefixing it with Today’s date.
This tutorial demonstrates use of one of very useful command wizard, 'Loop through each file in a folder'. Use this when you want to perform actions on some or all files in a folder. This command makes it much easier because you don't need to know how many files there are in advance. In addition this tutorial demonstrates conditional commands, file related commands and ability to use system date and time variables. |
|
 |
| We started using this product to copy data from legacy system to new system. Now we use it just to do about anything automated. Countless hours saved. Thank you guys. |
- Jack Greenberg
|
| Read Customer Testimonies >> |
|