'''[http://core.tcl.tk/tcllib/doc/trunk/embedded/www/tcllib/files/modules/fileutil/traverse.html%|%fileutil::traverse]''', a [tcllib] module, provides utilities for traversing directory hierarchies. ** Description ** [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 http://stackoverflow.com/questions/17633681/how-to-handle-permission-denied-when-using-fileutiltraverse%|%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 } ====== [Mho] 2020-10-12: Just tried `fileutil::traverse T c:/users` on my windows machine. After ~800k files I got this: `could not read link "c:/users/matthiasu/AppData/Local/Packages/Microsoft.Microsoft3DViewer_8wekyb3d8bbwe/LocalCache": invalid argument` Experimenting again later. Calling with an invalid (non existent) folder: the foldername itself is returned. Neither -prefilter nor -errorcmd triggered. <> Package | Tcllib | File