Basically i'm trying to print all excel files in a directory. In one of the folders, i don't have a excel file named '~$EndManifold-4Slot.xlsm', but while printing the files, i see this is present, which is actually not there.
Could anyone suggest on how to improve the same?
def Fnfolders(rootdir):
xlFilesList=[]
for dirname, dirnames, filenames in os.walk(rootdir):
for file in os.listdir(dirname):
if '.xls' in file or '.xlsx' in file:
fullPath=os.path.join(dirname)+"\\"+file
xlFilesList.append(fullPath)
return xlFilesList
xlFilesList=Fnfolders(rootdir)
for excel in xlFilesList:
print (excel)