Can t rename folder

broken image

It will make the changes right away (and Mac OS and Windows don’t let you to just hit “undo” - so be careful!). If you’re content with just renaming the files, feel free to run your code now. Phew! Ok, awesome! You’ve made it this far. rename() method on the file itself, passing in a concatenation of the directory and the new name.

broken image

(if you were to print out a new_name, it’d look like this: /Users/nikpi/Desktop/Files/2021–01–01 - East - Sales.xlsx) stem attribute) into meaningful names (region, report_type, and old_date)

broken image

broken image

We iterate over each file in the directory using the.There’s a little bit to unpack here, so let’s take a look step by step: