<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/8723" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2004-12-05T10:07:35-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/8723</id>

		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2004-12-05T10:07:35-04:00</updated>

		<published>2004-12-05T10:07:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=43488#p43488</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=43488#p43488"/>
		<title type="html"><![CDATA[reading the number of directories in a given folder]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=43488#p43488"><![CDATA[
<blockquote class="uncited"><div><div class="codebox"><p>Code: </p><pre><code>if [catch {set files [glob -directory $dir *]}]</code></pre></div></div></blockquote>you don't need to catch glob... use -nocomplain <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>Here's a dir counting proc that doesn't depend on external executables:<div class="codebox"><p>Code: </p><pre><code>proc dirs {root} {set i 0foreach dir [glob -noc -typ d -dir $root *] {incr i [expr {1+[dirs $dir]}]}set i}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Sun Dec 05, 2004 10:07 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2004-12-05T03:47:14-04:00</updated>

		<published>2004-12-05T03:47:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=43473#p43473</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=43473#p43473"/>
		<title type="html"><![CDATA[reading the number of directories in a given folder]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=43473#p43473"><![CDATA[
this will traverse the directory tree, executing $cmd on each file:<div class="codebox"><p>Code: </p><pre><code>proc traverse {dir cmd} {  if [catch {set files [glob -directory $dir *]}] return  foreach f $files {    if [file isdirectory $f] {traverse $f $cmd}    $cmd $f  }}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Sun Dec 05, 2004 3:47 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2004-12-05T03:17:01-04:00</updated>

		<published>2004-12-05T03:17:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=43472#p43472</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=43472#p43472"/>
		<title type="html"><![CDATA[reading the number of directories in a given folder]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=43472#p43472"><![CDATA[
the above simply returns number of directories in the current tree<br><br>if you want to traverse the tree, use [glob] and [file] commands<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Sun Dec 05, 2004 3:17 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2004-12-05T03:11:59-04:00</updated>

		<published>2004-12-05T03:11:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=43471#p43471</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=43471#p43471"/>
		<title type="html"><![CDATA[reading the number of directories in a given folder]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=43471#p43471"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>string trim [exec find . -type d | wc -l]</code></pre></div>(assuming it's not a windrop)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Sun Dec 05, 2004 3:11 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[qzec]]></name></author>
		<updated>2004-12-05T02:30:08-04:00</updated>

		<published>2004-12-05T02:30:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=43470#p43470</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=43470#p43470"/>
		<title type="html"><![CDATA[reading the number of directories in a given folder]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=43470#p43470"><![CDATA[
Hello World,<br><br>I have more or less just begun to work with tcl. After spending the past two weeks reading up on it and trying out all the neat features, I came up with some pretty nifty ideas for a tcl project (no the ideas aren’t relatively new).<br><br>But… (I bet you saw this one coming didn’t you?) I can’t seem to find out how to use tcl to read the number of directories in a given folder. I’m too tired to give a fancy example so let me whip up a quick doodle to illustrate (please keep the laughter to a minimal):<br><br>/area_51 <br>-/out_there <br>--/moo <br>--/arf <br>--/meow<br><br>(note: the dash represents the directory depth)<br><br>Now suppose the given folder was /area_51/out_there/<br><br>What I am trying to do is figure out how I will able to use tcl to read this folder and display some kind of output similar to:<br><br>Soldier: I’m not at liberty to tell you that we have 3 sounds stored out there. $@#%. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_mad.gif" width="15" height="15" alt=":x" title="Mad"> I just broke protocol... What am I going to do?! *lightbulb* I know!! <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> I’ll pretend you didn’t hear me. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><br><br>Now, the thing is, we don’t know the names of the directories in the given folder.<br><br>I’m assuming it’s possible to use some kind of wildmask? Actually at this point, I’m hoping it’s possible.<br><br>Q<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5735">qzec</a> — Sun Dec 05, 2004 2:30 am</p><hr />
]]></content>
	</entry>
	</feed>
