Skip to content

Instantly share code, notes, and snippets.

@BjornW
Created September 8, 2013 10:28
Show Gist options
  • Save BjornW/6483667 to your computer and use it in GitHub Desktop.
Save BjornW/6483667 to your computer and use it in GitHub Desktop.
Create multiple directories based on file input. Each line is one directory to create. In this case used to create a directory per site.
#!/bin/bash
# quick & dirty script to create multiple directories
# Load a file with one site per line
list=$(<sites.txt)
# add the list of sites to an array
myarray=( $list )
# for every site in the array create a directory
# e.g. burobjorn.nl
for n in ${!myarray[@]}; do
echo "creating directory ${myarray[$n]}"
mkdir ${myarray[$n]}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment