Session Ready
Exercise

Y'all got some renaming to do

After escaping the oppressive rent of the Bay Area by moving to Texas, you got a job at a dude ranch as their only programmer. Once a year they sell all of their cattle in an auction. You wrote their inventory control system from scratch in Python and the CEO said, "Not bad for a kid from 'Frisco'". The day before the auction the CEO comes up to you in a panic because the names of all of the cattle are wrong in the inventory control system. The CEO tells you, "Y'all got some renaming to do!".

longhorn

Rename all of the files in the cattle directory by replacing the phrase 'shorthorn' with 'longhorn'. The os and pathlib modules have been imported for you. Remember that the name variable will need to be split to be renamed.

Instructions
100 XP
  • Use os.walk to traverse the cattle directory.
  • Use pathlib to rename all files with 'shorthorn' to 'longhorn'.