# Traverse all the folder/file in current directory
file_list=os.listdir(path)
# Determine the element is folder or file. If file, pass it into list, if folder, recurse.
forfile_nameinfile_list:
# Get the abs directory using os.path.join() and store into cur_path.
cur_path=os.path.join(path,file_name)
# Determine whether folder
ifos.path.isdir(cur_path):
show_files(cur_path,all_files)
else:
all_files.append(cur_path)
returnall_files
defjoin(input_list,sep=None):
return(sepor' ').join(input_list)
defmain():
contents=show_files('examples/',[])
all_loc=[]
forfile_locincontents:
split_loc=file_loc.split('/')
# must have two sub-folder levels after examples folder, such as examples/images/vit is acceptable, examples/images/README.md is not, examples/requirements.txt is not.