|
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
|
Solution |
| 1. |
Create new task |
- Click on Tools->Task Editor.
|
| 2. |
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.
Screenshot 1
|
| 3. |
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.
Screenshot 2
|
| 4. |
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
in Screenshot
3 .
- 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.
|
Screenshot 1:

Screenshot 2:

Screenshot 3:

Screenshot 4:

|