Program to delete directories that do not contain a file I'm an intern and have an ETL project I'm doing in python.

Part of it is to make sure after I move files I delete empty directories. 

I wrote this code to clean up directories that are empty and in testing it works for me but I want to make sure it won't end up deleting folders full of files.

def folderCleanup(p_rootPath): 
    for r, dirs, files in os.walk(p_rootPath):
        for folder in dirs:

            if len(os.listdir(os.path.join(r, folder))) == 0: #Checks if the folders have anything in them
                shutil.rmtree(os.path.join(r, folder))

            elif hasFile(os.path.join(r, folder)): #Checks if a subfolder will have a file in it
                    pass
            else:  
                    shutil.rmtree(os.path.join(r, folder),ignore_errors=True)
            #end if
        #end for
    #end for
#end def

def hasFile(p_path): #Returns true if the given directory or any of its children directories have a file in them
    for r, d, f in os.walk(p_path):

        if len(f) &gt; 0:
            if len(f) == 1 and f[0] == 'Thumbs.db':
                continue
            else:
                return True
            #end if
        #end if
    #end for
    return False
#end def



I am just looking for some feedback and whether there are any potential problems with this code.
I didnt check the correctness of code, but... 

Small tips on comments:


Don't write #end if. You have identation. Why do you need it?
Comments for functions should look like


def hasFile(p_path):
    """Returns true if the given directory or any of its children directories have a file in them"""
    for r, d, f in os.walk(p_path):


https://saddlebackcss.github.io/tutorials/python/basic/2016/01/14/python-basics-4

Methods should be called like folder_cleanupand has_file. See https://visualgit.readthedocs.io/en/latest/pages/naming_convention.html

Do not name variables like this for r, d, f in os.walk(p_path):. Make names more meaningfull 

Try to reduce nesting, may be  using early return