Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 73daff148d27768b59558c8638fd522dd045154a
Ticket: 1880980fffffffffffffffffffffffffffffffff
Option to [glob] to ease recursive traversal
User & Date: evil_son on 2008-01-28 07:12:34
Changes

  1. assignee changed to: "dkf"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    
    Currently,  to traverse a directory hierarchy: in the top directory we need to explicitly glob for all directory entries (including those that start with a period) and then filter out "." and ".." and so on recursively for children directories
    
    The following suggested option to [glob] will simplify code as well as provide some speed increase.
    
    [glob -walk] will return all directory entries in the current dir including those that start with a period _except_ for "." and ".."  i.e it filters out the current and parent directories.  Other filters can be stacked on top of it as per usual with [glob]
    
    This option does _not_ walk the entire directory tree recursively.  As such the name "-walk" may be considered misleading.
    
    [glob -walk] essentially provides a filter to a previously suggested option [glob -all]: request id 1880967 at http://sourceforge.net/tracker/index.php?func=detail&aid=1880967&group_id=10894&atid=360894
    and may well be used more often than [glob -all] raising doubts about the need for the latter.
    
    Checking for recursive links in the filesystem is still the responsibility of the user.
    
    e.g usage. To print the names of all and only directories under $root:
    
    proc rec-print-dirs {dir} {
      puts $dir
      foreach d [glob -walk -directory $dir -types {d}] {
        rec-print-dirs $d
      }
    }
    rec-print-dirs $root
    
    Thank you
    E Wilson
    
    
  4. foundin changed to: "None"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "evil_son"
  10. subsystem changed to: "16. Commands A-H"
  11. title changed to: "Option to [glob] to ease recursive traversal"
  12. type changed to: "RFE"