![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | 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 |
| Want to Get List of All directories | niceboykunal123 | Shell Programming and Scripting | 6 | 05-06-2008 11:58 AM |
| how to list directories only | yodadbl07 | UNIX for Dummies Questions & Answers | 3 | 04-26-2006 01:48 AM |
| How to list only directories? | videsh77 | UNIX for Dummies Questions & Answers | 4 | 01-09-2006 06:10 AM |
| List directories | malaymaru | UNIX for Dummies Questions & Answers | 3 | 09-25-2005 06:54 AM |
| Script to list changes in Directories | aojmoj | Shell Programming and Scripting | 2 | 11-22-2003 06:51 PM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi All I have two scripts which i used to try and list all the directories one using 'function', which only lists the first directory and does not show directories within directories.
function ListDir () { for arg in $(ls $HOME) do if [ -d $1/$arg ] then echo $arg ListDir $arg fi done } Result home/<username>/ backup bin computer unix oracal There are driectories within 'computer' and 'unix' (prob with loop i think) The other lists, as i want it, but also includes the complete path name which i dont want. i tried using 'for' for arg in `find $HOME -type d -exec ls -d {} \;` do echo $arg >> outputfile done rm outputfile Result /home/<username>/ /home/<username>/backups /home/<username>/bin /home/<usermane>/computer /home/<username>/computer/dept /home/<username/unix /home/<username>/unix/accounts /home/<username>/oracal This goes through a funny loop repeating its self and addidn the new found dir to the end As you can see i just need the last directory I know you can do it so come on help me out thank you Chassis |
| Forum Sponsor | ||
|
|