|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
hi,
i wanna write a shell script which will list all the directories in that folder, it should only output dir no other file. is there a command to do so thanx Jyoti |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
JyotiC <jyoti.chhabra@gmail.com> wrote:
> i wanna write a shell script which will list all the directories in > that folder, > it should only output dir no other file. > is there a command to do so find . -type d -print Regards, Frank -- There are no threads in alt.binaries.pictures.erotica, so there's no gain in using a threaded news reader. -- unknown source |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 JyotiC wrote: > hi, > > i wanna write a shell script which will list all the directories in > that folder, > it should only output dir no other file. > is there a command to do so > > thanx > Jyoti > find "$MY_DIR" -type d man find i.A., - -- Stephan 'smg' Grein, <stephan at stephan minus rockt dot de> http://stephangrein.de GnuPG-Key-ID: 0xF8C275D4 FingerPrint: 5B6F 134A 189B A24D 342B 0961 8D4B 0230 F8C2 75D4 Geek by nature, Linux by choice. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iQIVAwUBRObePo1LAjD4wnXUAQKYlg/9HA67rqiEBY10aunic1RrjjCLEv8N6Akf Di3Vb479h6j1QASntku5zEKQUT7+RE6RlE2fFO1z6PLQU85H4S qOIFgHbtVBBwrO ZUG2Ft9LOcDytuJn9om/3LQP9dxHc/EnJTz+InfDWQjUNK/5xI3TlLtRcVOdeg92 5HK5nxTw//QXOErkH1E4blXwdMoLW5XQBMXTayCqP8adIkxtHYIpiyYTHiEI ncWM lM2QsPF6fYF1js9CCPLto2YJdhy20sVodTxDd4pNAi7mMEjuy3 IH8PLxbVpvxM1U nJjDyg0uBX/4QgyTrV5aW1/hL32J7+DBi2woCKdPhLjaUZW8R3E6gpG7Sxl4BoLe EpHA0h6cp6GbD42YnqmhVRKI+2kJb3ftnnGKUhRPwzCY0aIFTd F684KqRfh8ciSw J5eAXelXgNNjKMNKnHt9+oOCr3pIfFBoBXbzeDKd/VBgDgmYtGV9q7FS8L0bKPWY 5JnnQzS5MXoDKSaesrcPAi004SL9YhmBTVGx/nbThQS8UZrJPF7t14lYxJcyr8L0 U3EpsVZwv8QtMslVJ8hfYP4W51yZRpDz5ELzCg/rR+bzRsplcQC3kwnNQrOTQEe8 eaDD4qZ8PVKkOgb6W/uBkKBcoesCpnJuj8raFd+2Nx1wDBMJecQvUtZzHJMMpFtU 1EP0rKewVj0= =l3qd -----END PGP SIGNATURE----- |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
thanx for ur
with find -type d it's recursively going inside the directory and giving all the subdirectories is there a way through with i get only top directories, not the sub-dir thanx Jyoti |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
In comp.unix.shell JyotiC <jyoti.chhabra@gmail.com>:
> thanx for ur > with find -type d > it's recursively going inside the directory and giving all the > subdirectories > is there a way through with i get only top directories, not the sub-dir Sure just check the fine manual 'man find' on howto restrict 'find' to descend only how deep you want. Good luck BTW Since you might be new to usenet, this is *NOT* a groups.google forum, even if it looks like this to you, please quote context: "Google Groups users please read - Howto reply properly" http://groups.google.com/support/bin...y?answer=14213 -- Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94) mail: echo zvpunry@urvzvat.qr | perl -pe 'y/a-z/n-za-m/' #bofh excuse 28: CPU radiator broken |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
"JyotiC" <jyoti.chhabra@gmail.com> writes:
> hi, > > i wanna write a shell script which will list all the directories in > that folder, > it should only output dir no other file. > is there a command to do so Here's another quick solution (besides find) if you can deal with ls -l ls -l | grep '^d' -- Sending unsolicited commercial e-mail to this account incurs a fee of $500 per message, and acknowledges the legality of this contract. |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
2006-08-19, 03:11(-07), JyotiC:
> thanx for ur > with find -type d > it's recursively going inside the directory and giving all the > subdirectories > is there a way through with i get only top directories, not the sub-dir [...] find . \! -name . -prune -type d -print Or with most shells: printf '%s\n' */ With zsh: print -rl -- *(/) -- Stéphane |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 NotDashEscaped: You need GnuPG to verify this message * Stephane CHAZELAS <this.address@is.invalid> writes: > 2006-08-19, 03:11(-07), JyotiC: >> thanx for ur >> with find -type d >> it's recursively going inside the directory and giving all the >> subdirectories >> is there a way through with i get only top directories, not the sub-dir > [...] > find . \! -name . -prune -type d -print find . -type d -maxdepth 1 Seems a little easier. > Or with most shells: > printf '%s\n' */ > With zsh: > print -rl -- *(/) Neither of those would list the dot-directories. How about good ol' ls(1)... ls -d */ # just ordinary directories ls -d .*/ # just dot-directories ls -d .*/ */ # both Add `1' (one) to the options (ls -d1) if you need a single column. -- |---<Steve Youngs>---------------<GnuPG KeyID: A94B3003>---| | Te audire no possum. | | Musa sapientum fixa est in aure. | |----------------------------------<steve@youngs.au.com>---| -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.4 (GNU/Linux) Comment: The SXEmacs Project <http://www.sxemacs.org> Comment: Eicq - The SXEmacs ICQ Client <http://www.eicq.org/> iEYEARECAAYFAkTnAi8ACgkQHSfbS6lLMANCtQCg1PdqUrREIm XKj8DloHyq+99a 64AAoNacdLImlE2MuxVR4A/0JDowOgw6 =3pPB -----END PGP SIGNATURE----- |
|
![]() |
| Outils de la discussion | |
|
|