Hiya. I'm running a script to automatically create directories. The script so far looks like this:
***************************************
mkdir companies
mkdir candidates
cd companies
cat ../companies.cfg | perl -e "while (<>) {chomp;mkdir($_)}"
cd..
cd candidates
cat ../candidates.cfg | perl -e "while (<>) {chomp;mkdir($_)}"
cd..
*****************************
The candidates.cfg and companies.cfg simply contain the directory names to be created in each of those to sub directories.
Anyway, this script needs to be run so the same directory structure appears in all the parent folders. For example
1/companies/directory 1
1/companies/directory 2
1/candidates/directory 1
1/candidates/directory 2
2/companies/directory 1
2/companies/directory 2
2/candidates/directory 1
2/candidates/directory 2
and so forth.
The parent directories (i.e. 1, 2, etc) have already been created. There are around 5000 of them.
What I need to know is how to autotmatically change to the different directories, run the script I have so far, then cd.. back to the parent and move onto the next directory.
Any ideas how?
Jon