I want to create multiple folders/directories (if they don't exist) using information from a CSV file.
I have the information from csv as follows:
Column0 Column1 Column2 Column3
51 TestName1 0 https://siteAdress//completed/file.txt
53 TestName2 0 https://siteAdress//completed/file.txt
67 TestName1 2 https://siteAdress//uploads/file.txt
68 TestName1 2 https://siteAdress//uploads/file.txt
I want to iterate column3, if it contains 'uploads' then it should make a folder with the corresponding jobname mentioned on column1 then create 'input' folder and within it create respective file.txt file, and if column3 contains 'completed' then it should make 'output' folder (within that same jobname folder next to input folder) and then within it the 'file.txt' file. And do this for all jobs mentioned in column1.
Something like this:
TestName1/input/file.txt
TestName1/output/file.txt
TestName1/output2/file.txt
TestName2/input/file.txt
TestName2/output/file.txt
Note: Most of data will contain multiple output folders for each jobname. In this case it should create as many output folders as are mentioned in the csv file.
So far, I have done this:
import csv, os
#reads from csv file
with open('limitedresult.csv') as csvfile:
readCSV = csv.reader(csvfile, delimiter = ',')
for row in readCSV:
print(row)
Your help would be highly appreciated, please let me know if the question is still confusing and I will try to explain in more detail.