I struggled to find a way to create a script that creates a directory structure. It looks something like this:
/
shared
shared / projects
shared / series
shared / movies
shared / movies / action
You understand.
The file that the script reads is as follows:
shared backup
shared data
shared projects
shared projcets series
shared projects movies
shared projects movies action
I want to create a script that reads each line in a file and runs the following for each line: If the directory exists, it is placed in the directory and creates a structure from there, if the Directory does not exist, create it.
When all entries in the line are preceding, return to the original directory and read the next line.
My system is Ubuntu 10.10.
So far, Ive been doing this, but that doesn't work.
#!/bin/bash pwd=$(pwd) for structure in ${column[*]} do if [ $structure ] then cd $structure else mkdir $structure fi done cd $pwd
linux bash if-statement
user668905
source share