Skip to content

Instantly share code, notes, and snippets.

@conor-egan
Created May 20, 2014 14:43
Show Gist options
  • Save conor-egan/ba630767eac8e2aaa13a to your computer and use it in GitHub Desktop.
Save conor-egan/ba630767eac8e2aaa13a to your computer and use it in GitHub Desktop.
Bash script to read text file and create new directories
###################################################################
# Code cycles through a text file and creates a directory for every line in the file
# with the contents of the line the title of the directory
###################################################################
#! /bin/bash
while read line # while there are lines in the file
do
mkdir -p $line # create a new directory in the working directory titled with the #value of the line
done <filename.txt # filename.txt should be the name of the text file you are reading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment