![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to create a list of entries without vi | mpc8250 | Shell Programming and Scripting | 3 | 02-13-2008 12:56 AM |
| Create a list of files that were modified after a given date. | rkka | UNIX for Dummies Questions & Answers | 4 | 01-22-2008 02:12 AM |
| Read words from file and create new file using K-shell. | bsrajirs | Shell Programming and Scripting | 4 | 06-01-2007 09:15 AM |
| How create a large list of document ids in VI | ruben7566 | Shell Programming and Scripting | 1 | 04-05-2006 07:16 AM |
| How to create a dynamic list? | nir_s | Shell Programming and Scripting | 4 | 01-14-2005 09:14 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
how to create new dir fro a file list
Hi,
What will be the best way to do the follwing: i have a file calld dir.list /cav /cav/brif /usr/main /cat i want to run a script that will take each of the item in the file and create a new dir in a location that i'll choose it nee to do mkdir cav mkdir cav cd cav mkdir brif ...... thanks |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
I guess you need something like this:
Code:
for directory in `cat directories.txt`
do
mkdir directory;
done
|
|
#3
|
||||
|
||||
|
Try:
Code:
#! /bin/ksh curdir=`pwd` while read path; do if [[ ! -d $curdir$path ]]; then mkdir -p $curdir$path fi done < dirlist Regards, Tayyab |
|
#4
|
|||
|
|||
|
Well what i need is multiple creat for dir
i need to create the all path
/cav/usr/mmm/t i need to create /cav after that create the /cav/usr and then /cav/usr/mmm how can i do that from a script that will read the dir to creates from a file that will look like that: /cav/usr /benny/ddd/t /usr/clear /cacac/hhttt/to ..... Thanks a Mil |
|
#5
|
||||
|
||||
|
Have you tried to use shereenmotor's script? Does it do what you want? If it does not, then can you explain where it is failing?
|
|
#6
|
|||
|
|||
|
something like this, maybe?
awk '{print "mkdir "$1}' file | sh |
|
#7
|
|||
|
|||
|
A solution that doesn't need the combined horsepower of awk and a new shell is probably more efficient.
|
|||
| Google The UNIX and Linux Forums |