Anonymous user
Empty directory: Difference between revisions
→Tcl: Added implementation
(This Ruby code is ugly, but seems to work.) |
(→Tcl: Added implementation) |
||
Line 22:
return true
end</lang>
=={{header|Tcl}}==
<lang tcl>proc isEmptyDir {dir} {
# Get list of _all_ files in directory
set filenames [glob -nocomplain -tails -directory $dir * .*]
# Check whether list is empty (after filtering specials)
expr {![llength [lsearch -all -not -regexp $filenames {^\.\.?$}]]}
}</lang>
|