RosettaCodeData/Task/Empty-directory/Wren/empty-directory.wren
2023-07-01 13:44:08 -04:00

10 lines
307 B
Text

import "io" for Directory
var isEmptyDir = Fn.new { |path|
if (!Directory.exists(path)) Fiber.abort("Directory at '%(path)' does not exist.")
return Directory.list(path).count == 0
}
var path = "test"
var empty = isEmptyDir.call(path)
System.print("'%(path)' is %(empty ? "empty" : "not empty")")