import os,shutil
def getdirfiles(datadir, filepaths):
filenames = os.listdir(datadir)
for filename in filenames:
filepath = os.path.join(datadir, filename)
if os.path.isdir(filepath):
getdirfiles(filepath,filepaths)
elif os.path.isfile(filepath):
filepaths.append(filepath)
if __name__ == '__main__':
maindir=r'Project'
dstdir = r'temp'
filepaths=[]
getdirfiles(maindir,filepaths)
print(filepaths)