Currently I'm able to get and return files from a directory. However, it cannot get only xml files and get files from sub-folders.
Example folder:
folder
|_ folder1
|_file1.xml
|_file2.xml
|_ folder2
|_file3.xml
file4.xml
Expected return:
file1.xml
file2.xml
file3.xml
file4.xml
My current code is like this
def get_files(d):
return [os.path.join(d, f) for f in os.listdir(d) if os.path.isfile(os.path.join(d, f))]
get_files(*filepath*)
And the code only returns file4.xml