#!/usr/bin/env python3


import os
for foldername, subfolders,filenames in os.walk('/Users/ymccarter/'):
    print("The folder is " + foldername)
    print("The subfolder in"+foldername+" are "+str(subfolders))
    print("The filenames in "+foldername+" are "+str(filenames))

    for subfolders in subfolders:
        print("Subfolders  are "+subfolders)
        print("filename in subfolder "+subfolders +" are "+str(filenames))

#you can add more function with condiion:
    #for subfolders in subfolders:
         #if 'fish' in subfolders: #if the subfolder is named with "fish",
         #    os.rmdir(subfolders) # and then delete the folder (needs to be empty)

    #for file in filenames:
        if file.endswith('.py'): # if it is python file
            shutil.copy(os.join(folderName,file), os.join(folderName,file+".backup")) # rename the file as xxx.py.bacvkup" 

