Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 936fee3eeab28c126296a7f5f28cd527e92ce807
Ticket: 1880980fffffffffffffffffffffffffffffffff
Option to [glob] to ease recursive traversal
User & Date: evil_son on 2008-01-31 23:01:00
Changes

  1. icomment:
    Logged In: YES 
    user_id=1993540
    Originator: YES
    
    Following up on my previous post: what if glob -walk returned a list of pairs <filename, type (i.e. file or dir)> of all directory entries except for . and ..
    
    So to print out files under a directory (without error checking or checking for empty return lists):
    
    proc allfiles {dir} {
      foreach pair [glob -walk -directory $dir] {
      foreach {entry type} $pair {break}
      if {$type eq "d"} { allfiles $entry }
      elseif {$type eq "f"} { puts $entry } 
      }
    }
    allfiles someDir
    
    
    
  2. login: "evil_son"
  3. mimetype: "text/plain"
  4. username: "evil_son"