Objective

The objective of this practice problem is for the user to demonstrate an understanding of the File Operations and Folder Operations commands discussed in the previous section by creating an automation that utilizes said commands. The commands covered in the previous section were Rename File and Rename Folder. In the future, these commands may be implemented into other practice problems.

Scenario

A research assistant of ABC institute is asked by the Dean of the institute to update an Excel workbook containing grades of students. Once that is updated, the research assistant saves the Excel sheet with the name “UpdatedWorksheet1” in a folder called “New Folder”. The Dean of the institute then asks the research assistant to rename the file to “UpdatedMarksheet” and rename the folder to “Marksheet”. This task can be attained by renaming the file using Rename File command and renaming the folder using Rename Folder command

Prerequisites
The user must use a pre-existing Excel workbook file (.xlsx) and a folder called “New Folder” before starting to work on the solution. Below is a screenshot of the folder and the file that was created for this problem, feel free to recreate it or create a unique file. Feel free to delete this file and folder when finished with the exercise, although this will mean that the automation cannot be run again.
Practice Problem Requirements

The user must create an automation that performs the following tasks:

  • Renames a file (Path of the file needs to be specified and the new name must be specified)
  • Renames a folder (Path of the folder needs to be specified and the new name must be specified)

Problem Difficulty: Easy
Solution will be provided on the next page with a brief explanation.

Solution
The code for the solution has been provided below.
As a quick summary:

Step 1: The Rename File command allows a file to be renamed. The path of the file that needs to be renamed must be specified correctly. And the new name to which the file needs to be renamed must be specified. In this practice problem, the file is renamed to “UpdatedMarksheet”.

Step 2: The Rename Folder command allows a folder to be renamed. The path of the folder that needs to be renamed must be specified correctly. And the new name to which the folder needs to be renamed must be specified. In this practice problem, the folder is renamed to “Marksheet”.

Newsletter Bot

Lets stay in touch!

Join our weekly newsletter and follow us on social media.

Contact Sales
Call Our Experts!