<?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/5487" />

	<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>2003-09-08T19:12:53-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2003-09-08T19:12:53-04:00</updated>

		<published>2003-09-08T19:12:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26772#p26772</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26772#p26772"/>
		<title type="html"><![CDATA[directory/subdirectory]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26772#p26772"><![CDATA[
<blockquote class="uncited"><div>You don't.</div></blockquote>ok hehe ive been true so many different ways in the past that i am not sur witch one it was hehe so sorry for the wrong answer <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Mon Sep 08, 2003 7:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-09-08T09:30:14-04:00</updated>

		<published>2003-09-08T09:30:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26736#p26736</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26736#p26736"/>
		<title type="html"><![CDATA[directory/subdirectory]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26736#p26736"><![CDATA[
<blockquote class="uncited"><div>bad switch "-files": must be -nocomplain or --</div></blockquote>Ah..you're using some older tcl version I guess. Then you'll have to loop through the list of files and check each one using 'file isdirectory' / 'file isfile'<br><br>something like this:<div class="codebox"><p>Code: </p><pre><code>proc rglob {pattern {dir ./}} {   set files {}   regsub -all {[\\\[\]\{\}\?\*]} $dir {\\&amp;} dir   foreach file [glob -nocomplain [file join $dir *]] {      if {[file isfile $file]} {         if {[string match $pattern $file]} {lappend files $file}      } elseif {[file isdir $file]} {         set files [concat $files [rglob $pattern $file]]      }   }   set files}</code></pre></div>Being a newbie doesn't justify doing insane stuff like adding random arguments to a command. (like you did)<br>What version are you using btw?<br><br>EDIT: I added a regsub to escape any glob chars in the path. (This won't work under cygwin because of the transparent rewrite to backslashes in paths, so just remove the regsub and pray if you're using it on a win* box ;P ...or upgrade to a tcl version that supports the -dir option (for glob))<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Mon Sep 08, 2003 9:30 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2003-09-08T09:13:48-04:00</updated>

		<published>2003-09-08T09:13:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26735#p26735</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26735#p26735"/>
		<title type="html"><![CDATA[directory/subdirectory]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26735#p26735"><![CDATA[
here's what your proc does when adapted to my situation:<br><br>bad switch "-files": must be -nocomplain or --<div class="codebox"><p>Code: </p><pre><code>and for your information i read the manual and i could'nt find what interested me that's why i came in that forum. if you're not able to discuss with newbies because they are too dumb for you you should try another forum.thank you</code></pre></div><p>Statistics: Posted by Guest — Mon Sep 08, 2003 9:13 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-09-08T09:51:29-04:00</updated>

		<published>2003-09-08T08:39:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26734#p26734</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26734#p26734"/>
		<title type="html"><![CDATA[directory/subdirectory]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26734#p26734"><![CDATA[
<blockquote class="uncited"><div>if i remember correctly</div></blockquote>You don't.<br><br>In Tcl, backslash is the escape char and in most cases it will have to be escaped if you want it to be part of a string. The backslash char is also used for paths in dos, but when running Tcl through cygwin the paths are translated on the fly, so you can pretend you're on a UNIX machine and use forward slashes. (They don't need to be escaped.)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Mon Sep 08, 2003 8:39 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-09-08T08:38:19-04:00</updated>

		<published>2003-09-08T08:38:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26733#p26733</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26733#p26733"/>
		<title type="html"><![CDATA[directory/subdirectory]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26733#p26733"><![CDATA[
<blockquote class="uncited"><div>the command :<blockquote class="uncited"><div>glob -nocomplain d  c:/*/</div></blockquote></div></blockquote>You seem to have no idea what you're doing. Read the <a href="http://tcl.tk/man/tcl8.3/TclCmd/glob.htm" class="postlink">manual</a>. The glob command returns a list of files, the {}'s are just the way tcl chose to represent your data in the list. To access single elements from this list, use a foreach loop/other loop combined with list commands/just list commands. You might want to take a look at the proc i posted too...if you combine that with reading the manual you might learn a thing or two.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Mon Sep 08, 2003 8:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2003-09-08T08:21:19-04:00</updated>

		<published>2003-09-08T08:21:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26732#p26732</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26732#p26732"/>
		<title type="html"><![CDATA[directory/subdirectory]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26732#p26732"><![CDATA[
if i remember correctly you can't use it like that you should do this c:\path\\path\\ .. <br><br>or <br><br>c:/path//path// ..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Mon Sep 08, 2003 8:21 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2003-09-08T08:10:54-04:00</updated>

		<published>2003-09-08T08:10:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26730#p26730</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26730#p26730"/>
		<title type="html"><![CDATA[directory/subdirectory]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26730#p26730"><![CDATA[
the command :<br><blockquote class="uncited"><div>glob -nocomplain d  c:/*/</div></blockquote><br>gives me:<br><blockquote class="uncited"><div>c:/Config.Msi/ {c:/Documents and Settings/} c:/eMatrix9/ c:/I386/ c:/Inetpub/ c:/Lotus/ c:/MASTERS/ c:/MesSites/ {c:/Microsoft UAM Volume/} c:/MSSQL7/ {c:/OfficeScan NT/} c:/orant/ c:/orantold/ {c:/Program Files/} c:/RECYCLER/ {c:/System Volume Information/} c:/temp/ c:/WINNT/ c:/WUTemp/ </div></blockquote>first i have both directories and files (as usual) and second i don't understand why some directories are displayed between brackets whereas others are just displayed like c:/dir/<br><br>thank you for your answers... <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><p>Statistics: Posted by Guest — Mon Sep 08, 2003 8:10 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2003-09-08T05:32:51-04:00</updated>

		<published>2003-09-08T05:32:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26724#p26724</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26724#p26724"/>
		<title type="html"><![CDATA[directory/subdirectory]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26724#p26724"><![CDATA[
it still doesn't work and i don't understand why...<br>i obtain the same list of files and directories without distinction with both commands.<br>it's really weird if you tell me that it works...<p>Statistics: Posted by Guest — Mon Sep 08, 2003 5:32 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-09-08T04:45:12-04:00</updated>

		<published>2003-09-08T04:45:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26722#p26722</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26722#p26722"/>
		<title type="html"><![CDATA[directory/subdirectory]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26722#p26722"><![CDATA[
Works for me<br><div class="codebox"><p>Code: </p><pre><code>% catch { glob -type f /users/ppslim/sand/* } files0% set files/users/ppslim/sand/phpBB-2.0.6.tar.gz% catch { glob -type d /users/ppslim/sand/* } dirs0% set dirs/users/ppslim/sand/phpBB2</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Mon Sep 08, 2003 4:45 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2003-09-08T04:33:06-04:00</updated>

		<published>2003-09-08T04:33:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26721#p26721</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26721#p26721"/>
		<title type="html"><![CDATA[thanks]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26721#p26721"><![CDATA[
Thanks for your answers but I have met a problem with these commands:<br><br>catch { glob -type d /the/way/to/path/* } dirs  <br><br>catch { glob -type f /the/way/to/path/* } files  <br><br>both give me the same result and it's impossible for me to know whether an element is a file or a directory.<br><br>maybe I'm not using the options in the right way...<br><br>thanx for your help<p>Statistics: Posted by Guest — Mon Sep 08, 2003 4:33 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-09-04T13:02:27-04:00</updated>

		<published>2003-09-04T13:02:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26485#p26485</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26485#p26485"/>
		<title type="html"><![CDATA[directory/subdirectory]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26485#p26485"><![CDATA[
<blockquote class="uncited"><div>The "catch" looks to me like a set, at least it dose exactly the same thing.</div></blockquote>The catch will result having the error message stored in the variable if there are no matches and would require an "if" to determine the outcome. Usually you do some kind of loop through the list of names and since foreach doesn't execute its body when passed an empty list, using -nocomplain will lead to results most people find convenient <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Thu Sep 04, 2003 1:02 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-09-04T12:46:39-04:00</updated>

		<published>2003-09-04T12:46:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26484#p26484</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26484#p26484"/>
		<title type="html"><![CDATA[directory/subdirectory]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26484#p26484"><![CDATA[
The "catch" looks to me like a set, at least it dose exactly the same thing.. Till now I didn't had problems like you've said, anyway, sugestion noted. Thanks.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Thu Sep 04, 2003 12:46 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-09-04T10:32:28-04:00</updated>

		<published>2003-09-04T10:32:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26477#p26477</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26477#p26477"/>
		<title type="html"><![CDATA[directory/subdirectory]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26477#p26477"><![CDATA[
<blockquote class="uncited"><div><div class="codebox"><p>Code: </p><pre><code>catch { glob -type d /the/way/to/path/* } dirs</code></pre></div></div></blockquote>You should start listening to your own advice <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> (learn what you don't know <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile">) As I said before in the <a href="http://forum.egghelp.org/viewtopic.php?t=5473" class="postlink">weird</a> thread, I recommend -nocomplain to avoid having to 'catch' the glob, and -dir to avoid matching problems. Remember that the last argument(s) to glob is/are used as a <a href="http://tcl.tk//man/tcl8.3/TclCmd/glob.htm#M11" class="postlink">glob matching pattern</a>.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Thu Sep 04, 2003 10:32 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-09-04T10:17:42-04:00</updated>

		<published>2003-09-04T10:17:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26476#p26476</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26476#p26476"/>
		<title type="html"><![CDATA[Re: directory/subdirectory]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26476#p26476"><![CDATA[
Try this little proc<div class="codebox"><p>Code: </p><pre><code>proc recursiveGlob {pattern {dir ./}} {set files [glob -nocomplain -types f -dir $dir $pattern]foreach d [glob -nocomplain -types d -dir $dir *] {set files [concat $files [recursiveGlob $pattern $d]]}set files}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Thu Sep 04, 2003 10:17 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-09-04T10:13:15-04:00</updated>

		<published>2003-09-04T10:13:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26474#p26474</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26474#p26474"/>
		<title type="html"><![CDATA[directory/subdirectory]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26474#p26474"><![CDATA[
well.. for dirs:<div class="codebox"><p>Code: </p><pre><code>catch { glob -type d /the/way/to/path/* } dirs</code></pre></div>as for files:<div class="codebox"><p>Code: </p><pre><code>catch { glob -type f /the/way/to/path/* } files</code></pre></div>In $dirs you will have the name of the dirs and in $files you will have the name of the files. Hope this helps.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Thu Sep 04, 2003 10:13 am</p><hr />
]]></content>
	</entry>
	</feed>
