mercredi 8 avril 2020

how to check the specific files is present in folder or not in automated way in python

I have 1000 of the folders in each of their different pdf files available. I have go into each folder and check whether their specific file( for example folder is named as school0001 and files is named as following it schoool_1m.pdf, schoool_2m.pdf.. schoool_10m.pdf) now I have go into the first folder and check all the month 1 to month 10 pdf available or not like that I have to check all the 1000 folder (the folder are named into school0001 ...........school1000.) after the check it. I have created a data frame as follows.

I want the result as follows

if the _m1.pdf is present in the folder it has yes or no in data frame like that for all the 10 files in each folder (totally 1000 folder)

s1          m1        m2   ...     m10

school0001  yes      yes          yes
school0002  no       yes          yes
school0003  yes      no          yes
..
..
..
school1000  yes      yes          yes

Aucun commentaire:

Enregistrer un commentaire