Updated 2013-12-11 11:43:19 by RLE

fileutil::traverse, a tcllib module, provides utilities for traversing directory hierarchies.

Description  edit

hv: While traversing down a directory, there are times when you encounter one that is not accessible. While the documentation stated that the package will ignore those directories by default. In reality, my sample script crashed. Curious, I dug into the source code and found what might be a bug. I posted the problem and a work-around solution on StackOverflow

To sum up, I used the -prefilter option to determine if a directory is readbale:
package require fileutil::traverse

proc isAccessible {absPath} {
    return [file readable $absPath]

# Main
set searchDir /tmp
fileutil::traverse t $searchDir -prefilter isAccessible

puts "\nFiles in $searchDir:"
t foreach fileName {
    puts $fileName