<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: HowTo: Linux / UNIX List Just Directories Or Directory Names</title> <atom:link href="http://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/feed/" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/</link> <description>Every answer asks a more beautiful question.</description> <lastBuildDate>Fri, 10 Feb 2012 19:55:56 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: SilversleevesX</title><link>http://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/#comment-62640</link> <dc:creator>SilversleevesX</dc:creator> <pubDate>Wed, 21 Sep 2011 15:26:01 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-list-just-directories-or-directory-names/#comment-62640</guid> <description>Commenting on Eric&#039;s ls &#124; grep &#124; awk combination:
Cygwin (1.7.9) displays &lt;strong&gt;8&lt;/strong&gt;, not 9, fields in &lt;ul&gt;ls -l&lt;/ul&gt;.
So change his &quot;awk &#039;{print 9}&#039;&quot; to awk &#039;{print 8}&#039; and you&#039;ll get more than a bunch of deadspace in mintty.
Just in case it wasn&#039;t already obvious. *S*
BZT</description> <content:encoded><![CDATA[<p>Commenting on Eric&#8217;s ls | grep | awk combination:<br
/> Cygwin (1.7.9) displays <strong>8</strong>, not 9, fields in<ul>ls -l</ul><p>.</p><p>So change his &#8220;awk &#8216;{print 9}&#8217;&#8221; to awk &#8216;{print 8}&#8217; and you&#8217;ll get more than a bunch of deadspace in mintty.</p><p>Just in case it wasn&#8217;t already obvious. *S*</p><p>BZT</p> ]]></content:encoded> </item> <item><title>By: Ashish</title><link>http://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/#comment-60127</link> <dc:creator>Ashish</dc:creator> <pubDate>Mon, 20 Jun 2011 15:58:02 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-list-just-directories-or-directory-names/#comment-60127</guid> <description>A cleaner Recipe for the same using AWK :
ls -l &#124; egrep &#039;^d&#039; &#124; awk &#039;{ print $9}&#039;
another alternate is bit clumsy :
ls -l &#124; egrep &#039;^d&#039; &#124; awk &#039;$1=&quot; &quot;,$2=&quot; &quot;&#039; &#124; awk &#039;$1=&quot; &quot;,$2=&quot; &quot;&#039; &#124; awk &#039;$1=&quot; &quot;,$2=&quot; &quot;&#039; &#124; awk &#039;$1=&quot; &quot;,$2=&quot; &quot;&#039;
Another Simpler and Faster way out to get the Desired result :
ls -l&#124;grep &#039;^d&#039;</description> <content:encoded><![CDATA[<p>A cleaner Recipe for the same using AWK :</p><p>ls -l | egrep &#8216;^d&#8217; | awk &#8216;{ print $9}&#8217;</p><p>another alternate is bit clumsy :</p><p>ls -l | egrep &#8216;^d&#8217; | awk &#8216;$1=&#8221; &#8220;,$2=&#8221; &#8220;&#8216; | awk &#8216;$1=&#8221; &#8220;,$2=&#8221; &#8220;&#8216; | awk &#8216;$1=&#8221; &#8220;,$2=&#8221; &#8220;&#8216; | awk &#8216;$1=&#8221; &#8220;,$2=&#8221; &#8220;&#8216;</p><p>Another Simpler and Faster way out to get the Desired result :</p><p>ls -l|grep &#8216;^d&#8217;</p> ]]></content:encoded> </item> <item><title>By: dccrowley</title><link>http://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/#comment-55648</link> <dc:creator>dccrowley</dc:creator> <pubDate>Tue, 15 Feb 2011 11:19:14 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-list-just-directories-or-directory-names/#comment-55648</guid> <description>works :)) Thanks</description> <content:encoded><![CDATA[<p>works :)) Thanks</p> ]]></content:encoded> </item> <item><title>By: asl.marc</title><link>http://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/#comment-54727</link> <dc:creator>asl.marc</dc:creator> <pubDate>Thu, 06 Jan 2011 18:53:29 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-list-just-directories-or-directory-names/#comment-54727</guid> <description>alias lsdir=&#039;ls -d ./*/ &#124; cut -d / -f 2&#039;
lsdir
for i in `lsdir` ; do du -ks $i; done</description> <content:encoded><![CDATA[<p>alias lsdir=&#8217;ls -d ./*/ | cut -d / -f 2&#8242;</p><p>lsdir</p><p>for i in `lsdir` ; do du -ks $i; done</p> ]]></content:encoded> </item> <item><title>By: alireza</title><link>http://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/#comment-50253</link> <dc:creator>alireza</dc:creator> <pubDate>Thu, 21 Oct 2010 08:20:08 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-list-just-directories-or-directory-names/#comment-50253</guid> <description>Hello.
I would like to do some batching in my linux but I couldn&#039;t find any way of initializing an array containing folder&#039;s location information. In short, I have data in two folders located at:
/home/alireza/Desktop/DTIBetula101019/B2509.30
/home/alireza/Desktop/DTIBetula101019/B2509.50
and I want to make an array following by a loop to do some specific  command inside each folder seprately like this:
fn_list= (&#039;/home/alireza/Desktop/DTIBetula101019/B2509.30&#039;,&#039;/home/alireza/Desktop/DTIBetula101019/B2509.50&#039;)
for fn in ${fn_list}
do
cd $fn
fsl4.1-fslmerge -t big4D 2501.45-DTI1-s007 2501.45-DTI2-s008 2501.45-DTI3-s009
done
can anybody help me to figure out how to specify an array that can pointed to a folder which can be reused during a for loop?
Thanks
/Alireza</description> <content:encoded><![CDATA[<p>Hello.<br
/> I would like to do some batching in my linux but I couldn&#8217;t find any way of initializing an array containing folder&#8217;s location information. In short, I have data in two folders located at:<br
/> /home/alireza/Desktop/DTIBetula101019/B2509.30<br
/> /home/alireza/Desktop/DTIBetula101019/B2509.50</p><p>and I want to make an array following by a loop to do some specific  command inside each folder seprately like this:</p><p>fn_list= (&#8216;/home/alireza/Desktop/DTIBetula101019/B2509.30&#8242;,&#8217;/home/alireza/Desktop/DTIBetula101019/B2509.50&#8242;)</p><p>for fn in ${fn_list}<br
/> do<br
/> cd $fn<br
/> fsl4.1-fslmerge -t big4D 2501.45-DTI1-s007 2501.45-DTI2-s008 2501.45-DTI3-s009<br
/> done</p><p>can anybody help me to figure out how to specify an array that can pointed to a folder which can be reused during a for loop?</p><p>Thanks<br
/> /Alireza</p> ]]></content:encoded> </item> <item><title>By: Volomike</title><link>http://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/#comment-49981</link> <dc:creator>Volomike</dc:creator> <pubDate>Fri, 08 Oct 2010 02:53:13 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-list-just-directories-or-directory-names/#comment-49981</guid> <description>&lt;code&gt;
alias ldir=&quot;ls -d -1 */ &#124; tr -d &#039;/&#039;&quot;
ldir
&lt;/code&gt;</description> <content:encoded><![CDATA[<p><code><br
/> alias ldir="ls -d -1 */ | tr -d '/'"<br
/> ldir<br
/> </code></p> ]]></content:encoded> </item> <item><title>By: danio</title><link>http://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/#comment-48976</link> <dc:creator>danio</dc:creator> <pubDate>Mon, 23 Aug 2010 10:20:20 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-list-just-directories-or-directory-names/#comment-48976</guid> <description>@Davis:
ls -l &#124; awk &#039;{ print $1,$3,$9 }&#039;</description> <content:encoded><![CDATA[<p>@Davis:<br
/> ls -l | awk &#8216;{ print $1,$3,$9 }&#8217;</p> ]]></content:encoded> </item> <item><title>By: balarajangeetha</title><link>http://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/#comment-48637</link> <dc:creator>balarajangeetha</dc:creator> <pubDate>Wed, 04 Aug 2010 14:34:41 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-list-just-directories-or-directory-names/#comment-48637</guid> <description>//Mohammed asif December 9, 2009
is their any alternative solution or trick to enter into the directory with the name having space.please explain//
did you try
cd &quot;file data&quot;
or
cd &#039;file data&#039;
( i.e. directory name with double quotes or single quote)
you yourself have given the hint :-)</description> <content:encoded><![CDATA[<p>//Mohammed asif December 9, 2009<br
/> is their any alternative solution or trick to enter into the directory with the name having space.please explain//<br
/> did you try<br
/> cd &#8220;file data&#8221;<br
/> or<br
/> cd &#8216;file data&#8217;<br
/> ( i.e. directory name with double quotes or single quote)<br
/> you yourself have given the hint :-)</p> ]]></content:encoded> </item> <item><title>By: Davis</title><link>http://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/#comment-47084</link> <dc:creator>Davis</dc:creator> <pubDate>Tue, 27 Apr 2010 02:17:19 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-list-just-directories-or-directory-names/#comment-47084</guid> <description>How do you get the directory listing to display only: the file name, the user that owns the file and that user’s permissions?</description> <content:encoded><![CDATA[<p>How do you get the directory listing to display only: the file name, the user that owns the file and that user’s permissions?</p> ]]></content:encoded> </item> <item><title>By: newbee1</title><link>http://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/#comment-46240</link> <dc:creator>newbee1</dc:creator> <pubDate>Wed, 03 Mar 2010 18:52:25 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-list-just-directories-or-directory-names/#comment-46240</guid> <description>if you wanted to pull a date from the directory  to only list files from datea/timea through dateb/timeb (say March 2 at 6:00 AM to March 8 at 6:00 AM) and move into a new file the output, how is this accomplished?  I tried this but no output
#!/bin/bash
FILES=&#039;ls -A1&#039;
OUTFILE=&quot;c:/temp/RRDfilesinrange.txt&quot;
STARTDATE=&#039;date --utc --date &quot;2010-02-27 06:00:00&quot; %s&#039;
ENDDATE=&#039;date --utc --date &quot;2010-03-02 06:00:00&quot; %s&#039;
cd C: temp/tsfr-complete
for f in $FILES
do
if [ -f $f ]; then
FDATE=&#039;stat -c &quot;%Z&quot; $f&#039;
if [ $FDATE -ge $STARTDATE ]; then
if [ $FDATE -le $ENDDATE ]; then
&#039;echo $f &gt;&gt; $OUTFILE&#039;
fi
fi
fi
done</description> <content:encoded><![CDATA[<p>if you wanted to pull a date from the directory  to only list files from datea/timea through dateb/timeb (say March 2 at 6:00 AM to March 8 at 6:00 AM) and move into a new file the output, how is this accomplished?  I tried this but no output<br
/> #!/bin/bash<br
/> FILES=&#8217;ls -A1&#8242;<br
/> OUTFILE=&#8221;c:/temp/RRDfilesinrange.txt&#8221;<br
/> STARTDATE=&#8217;date &#8211;utc &#8211;date &#8220;2010-02-27 06:00:00&#8243; %s&#8217;<br
/> ENDDATE=&#8217;date &#8211;utc &#8211;date &#8220;2010-03-02 06:00:00&#8243; %s&#8217;<br
/> cd C: temp/tsfr-complete<br
/> for f in $FILES<br
/> do<br
/> if [ -f $f ]; then<br
/> FDATE=&#8217;stat -c &#8220;%Z&#8221; $f&#8217;<br
/> if [ $FDATE -ge $STARTDATE ]; then<br
/> if [ $FDATE -le $ENDDATE ]; then<br
/> &#8216;echo $f &gt;&gt; $OUTFILE&#8217;<br
/> fi<br
/> fi<br
/> fi<br
/> done</p> ]]></content:encoded> </item> <item><title>By: Sirdude</title><link>http://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/#comment-46142</link> <dc:creator>Sirdude</dc:creator> <pubDate>Thu, 25 Feb 2010 18:27:44 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-list-just-directories-or-directory-names/#comment-46142</guid> <description>nice stuff!
i learned a lot from the original post, but the comments are a treasure trove!
one thing about the original post, you have a back tick instead of a single quote in the 1st two snippets
ls -l &#124; egrep `^d&#039; for example should be ls -l &#124; egrep &#039;^d&#039; for the copy / pasters
thanks again ;)</description> <content:encoded><![CDATA[<p>nice stuff!</p><p>i learned a lot from the original post, but the comments are a treasure trove!</p><p>one thing about the original post, you have a back tick instead of a single quote in the 1st two snippets<br
/> ls -l | egrep `^d&#8217; for example should be ls -l | egrep &#8216;^d&#8217; for the copy / pasters</p><p>thanks again ;)</p> ]]></content:encoded> </item> <item><title>By: Mohammed asif</title><link>http://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/#comment-45108</link> <dc:creator>Mohammed asif</dc:creator> <pubDate>Wed, 09 Dec 2009 11:29:45 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-list-just-directories-or-directory-names/#comment-45108</guid> <description>i renamed a directory name with a space in between the directory name within GUI(Graphical User Interface)
which is allowed and now in the shell prompt i.e. in the terminal command mode i want to enter the directory which has a space in between but it does not allows to enter into that directory it says &quot;INVALID DIRECTORY&quot;
is their any alternative solution or trick to enter into the directory with the name having space.please explain
the directory name is &quot;file data&quot;
i tried with    ---     $cd file data    but it didnt work out.</description> <content:encoded><![CDATA[<p>i renamed a directory name with a space in between the directory name within GUI(Graphical User Interface)<br
/> which is allowed and now in the shell prompt i.e. in the terminal command mode i want to enter the directory which has a space in between but it does not allows to enter into that directory it says &#8220;INVALID DIRECTORY&#8221;<br
/> is their any alternative solution or trick to enter into the directory with the name having space.please explain<br
/> the directory name is &#8220;file data&#8221;<br
/> i tried with    &#8212;     $cd file data    but it didnt work out.</p> ]]></content:encoded> </item> <item><title>By: Amr</title><link>http://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/#comment-44271</link> <dc:creator>Amr</dc:creator> <pubDate>Fri, 23 Oct 2009 07:58:12 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-list-just-directories-or-directory-names/#comment-44271</guid> <description>I tried with both GNU ls and BSD one and the best option is as someone else posted above:
ls -ld */</description> <content:encoded><![CDATA[<p>I tried with both GNU ls and BSD one and the best option is as someone else posted above:</p><p>ls -ld */</p> ]]></content:encoded> </item> <item><title>By: Amit Nagwanshi</title><link>http://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/#comment-44159</link> <dc:creator>Amit Nagwanshi</dc:creator> <pubDate>Tue, 20 Oct 2009 05:30:47 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-list-just-directories-or-directory-names/#comment-44159</guid> <description>one can list directory i simple and easy way by :
1. ls -ltr &#124; grep -e d
2. ls -ld */
3. du
third one is the most easiest way. :-)</description> <content:encoded><![CDATA[<p>one can list directory i simple and easy way by :<br
/> 1. ls -ltr | grep -e d<br
/> 2. ls -ld */<br
/> 3. du</p><p>third one is the most easiest way. :-)</p> ]]></content:encoded> </item> <item><title>By: anon</title><link>http://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/#comment-44023</link> <dc:creator>anon</dc:creator> <pubDate>Wed, 07 Oct 2009 18:36:19 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-list-just-directories-or-directory-names/#comment-44023</guid> <description>$ /bin/ls -l &#124; grep &quot;^d&quot; &#124; cut -d&#039; &#039; -f8
it&#039;s a neat trick on linux systems.
i&#039;m using /bin/ls and not ls because it may be aliased</description> <content:encoded><![CDATA[<p>$ /bin/ls -l | grep &#8220;^d&#8221; | cut -d&#8217; &#8216; -f8<br
/> it&#8217;s a neat trick on linux systems.</p><p>i&#8217;m using /bin/ls and not ls because it may be aliased</p> ]]></content:encoded> </item> <item><title>By: Aditya</title><link>http://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/#comment-42766</link> <dc:creator>Aditya</dc:creator> <pubDate>Tue, 28 Jul 2009 14:38:22 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-list-just-directories-or-directory-names/#comment-42766</guid> <description>&gt;  i used to the $ du command to retrieve all directory names.
Jagan,
du is used to calculate Disk Usage. I want to know did you tweak this command to display directory listing in pwd.  Please explain.</description> <content:encoded><![CDATA[<p>&gt;  i used to the $ du command to retrieve all directory names.<br
/> Jagan,<br
/> du is used to calculate Disk Usage. I want to know did you tweak this command to display directory listing in pwd.  Please explain.</p> ]]></content:encoded> </item> <item><title>By: jagan</title><link>http://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/#comment-42306</link> <dc:creator>jagan</dc:creator> <pubDate>Tue, 30 Jun 2009 12:29:49 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-list-just-directories-or-directory-names/#comment-42306</guid> <description>i used to the $ du command to retrieve all directory names.
$ du</description> <content:encoded><![CDATA[<p>i used to the $ du command to retrieve all directory names.<br
/> $ du</p> ]]></content:encoded> </item> <item><title>By: kopla</title><link>http://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/#comment-41528</link> <dc:creator>kopla</dc:creator> <pubDate>Fri, 08 May 2009 10:34:14 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-list-just-directories-or-directory-names/#comment-41528</guid> <description>oops! didnt read the other comments. Already many nice solutions have been posted :P</description> <content:encoded><![CDATA[<p>oops! didnt read the other comments. Already many nice solutions have been posted :P</p> ]]></content:encoded> </item> <item><title>By: kopla</title><link>http://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/#comment-41527</link> <dc:creator>kopla</dc:creator> <pubDate>Fri, 08 May 2009 10:22:23 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-list-just-directories-or-directory-names/#comment-41527</guid> <description>Thanx, nice post. I was just thinking of doing it with awk but couldnt get the wildcard working. Now I am one step ahead in my shell knowledge ^^
To Dennis Quek above :
A rather dirty solution but does the job.
ls -l &#124; egrep &#039;^d&#039; &#124; awk &#039;$1=&quot; &quot;&#039; &#124; awk &#039;$1=&quot; &quot;&#039; &#124; awk &#039;$1=&quot; &quot;&#039; &#124; awk &#039;$1=&quot; &quot;&#039; &#124; awk &#039;$1=&quot; &quot;&#039; &#124; awk &#039;$1=&quot; &quot;&#039;&#124; awk &#039;$1=&quot; &quot;&#039;&#124; awk &#039;$1=&quot; &quot;&#039;
(forgive me if seeing this code gives someone a heart attack, all i can say is that I&#039;m still learning :P )
I would love if someone can give my code a neater look :)</description> <content:encoded><![CDATA[<p>Thanx, nice post. I was just thinking of doing it with awk but couldnt get the wildcard working. Now I am one step ahead in my shell knowledge ^^<br
/> To Dennis Quek above :<br
/> A rather dirty solution but does the job.</p><p>ls -l | egrep &#8216;^d&#8217; | awk &#8216;$1=&#8221; &#8220;&#8216; | awk &#8216;$1=&#8221; &#8220;&#8216; | awk &#8216;$1=&#8221; &#8220;&#8216; | awk &#8216;$1=&#8221; &#8220;&#8216; | awk &#8216;$1=&#8221; &#8220;&#8216; | awk &#8216;$1=&#8221; &#8220;&#8216;| awk &#8216;$1=&#8221; &#8220;&#8216;| awk &#8216;$1=&#8221; &#8220;&#8216;</p><p>(forgive me if seeing this code gives someone a heart attack, all i can say is that I&#8217;m still learning :P )<br
/> I would love if someone can give my code a neater look :)</p> ]]></content:encoded> </item> <item><title>By: Dennis Quek</title><link>http://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/#comment-41477</link> <dc:creator>Dennis Quek</dc:creator> <pubDate>Tue, 05 May 2009 07:35:27 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-list-just-directories-or-directory-names/#comment-41477</guid> <description>Can you just list the directories name, without the permission, datetime, and etc ... ?</description> <content:encoded><![CDATA[<p>Can you just list the directories name, without the permission, datetime, and etc &#8230; ?</p> ]]></content:encoded> </item> </channel> </rss>
