I have an Excel sheet which has a list of folder names. I have to read the Excel sheet and create folder names on my drive. However if the process breaks during creation or if there is an exception then when I rerun the process it should exclude the folders which have already have been created.
Below is my current Python code:
data = pd.read_excel(r'C://Users//file1//Desktop//folderlist.xls')
print(data["producttype"])#folder list is in producttype column name
print(data.head())
data.drop("Unnamed: 0",axis=1,inplace=True)
root=(r'C://Users//file1//Desktop//google//')
dirlist =pd.DataFrame( [ item for item in os.listdir(root) if os.path.isdir(os.path.join(root, item)) ])
df=pd.DataFrame([x[0] for x in os.walk(r'C://Users//file1//Desktop//google//')])
print(dirlist)
for i in dirlist:
for k,j in enumerate(data["producttype"]):
if i==j:
data.drop(data.producttype.index[k],axis=0,inplace=True)
While this is executing it is not excluding the already created folders.
Can someone help me to fix the issue?