I have a main folder: e:\\PLUS
, which contains another 4 subfolders (A,B,C,D
). Now, my python code saves all the html files from the main folder (PLUS
) but doesn't save the files from the other 4 subfolders.
Can anyone update my code a little bit, so as to save the files also from the subfolders?
def check_links_for_all_files(directory_name):
for file in os.listdir(directory_name):
filename = str(file)
print(filename)
if filename.endswith(".html"): #or filename.endswith(".php"):
file_path = os.path.join(directory_name, filename)
check_link(file_path)
else:
continue
if __name__ == '__main__':
check_links_for_all_files("e:\\Plus")