Your flash disk with important school files was infected by an LHS virus. You have successfully scanned and removed the virus from all folders in the flash disk. However, you have noticed that one defect was not fixed by the Antivirus program. The virus converted all your Text (“[filename].txt”) files to an unknown LHS format (“[filename].lhs”). When you inspected one of the files, you discovered that the filename and contents were not modified. The virus just changed the extension from “.txt” to “.lhs”. Changing back the extension to “.txt” fixes the issue.
A quick search of the flash disk indicates that you have more than 10,000 text files spread over more than 100 folders. It is going to be impractical to rename all the files manually.
Project Objectives:
The flash disk contents are in a folder named “flash-disk”. Create a program that can visit each folder and its subfolders in the “flash-disk” and rename all “.lhs” files to “.txt”. Once done, display how many folders were visited and how many affected files were fixed by your program.