I am trying to append the name of a folder to all filenames within that folder. I have to loop through a parent folder that contain sub folders. I have to do this in Python and not a bat file.
Example is, take these folders:
Parent Folder
 Sub1
  example01.txt
  example01.jpg
  example01.tif
 Sub2
  example01.txt
  example01.jpg
  example01.tif
To this
Parent Folder
 Sub1
  Sub1_example01.txt
  Sub1_example01.jpg
  Sub1_example01.tif
 Sub2
  Sub2_example01.txt
  Sub2_example01.jpg
  Sub2_example01.tif
I believe its os.rename, but i cant work out how to call the folder name.
Thanks for the advice.
 
     
     
    