Jump to content

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>
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.