Learn N Try

For all Lean Enthusiast

Bulk Directory creation

This is the script to generate the directory in bulk.

Create one file “Dirs” and put all the directory path you want to create. Copy the following code in one script. This script will check if directory does not exist then it will create new.

for dir in `cat Dirs`
do
echo $dir
if [[ ! -e $dir ]]; then
mkdir -p $dir
echo “dir does not exist $dir”
elif [[ ! -d $dir ]]; then
echo “$dir already exists but is not a directory” 1>&2
fi
done