I have a text file that reading the directories i need to create the only problem is I need to include a if statement to check if the directory is already made. How do I go about doing this I have these two files currently..
#1/bin/bash
cat directory.txt | while read -r line; do {
mkdir -p "`echo $line | sed -r -e 's# #/#g'`"
}; done
exit 0
It's reading from directory.txt which is this.
ktc
ktc/accounting
ktc/accounting/accountsreceivable
ktc/accounting/accountspayable
ktc/accounting/genledger
ktc/manufacturing
ktc/manufacturing/shift1
ktc/manufacturing/shift2
ktc/manufacturing/shift3
ktc/sales
ktc/sales/northern
ktc/sales/northern/dist1
ktc/sales/northern/dist2
ktc/sales/eastern
ktc/sales/eastern/dist1
ktc/sales/eastern/dist2
ktc/sales/western
ktc/sales/western/dist1
ktc/sales/western/dist2
ktc/sales/southern
ktc/sales/southern/dist1
ktc/sales/southern/dist2
ktc/shipping/
ktc/shipping/shift1
ktc/shipping/shift2
ktc/shipping/shift3
ktc/shipping/shift4
ktc/IT
ktc/IT/project1
ktc/IT/project2
ktc/IT/project3
ktc/IT/project4
ktc/IT/project5