procedure test(string filename) string msg switch get_file_type(filename) do case FILETYPE_UNDEFINED: msg = "is UNDEFINED" case FILETYPE_NOT_FOUND: msg = "is NOT_FOUND" case FILETYPE_FILE: msg = "is a FILE" case FILETYPE_DIRECTORY: sequence d = dir(filename) integer count = 0 for i=1 to length(d) do if not find(d[i][D_NAME],{".",".."}) then count += 1 end if end for if count=0 then msg = "is an empty directory" else msg = sprintf("is a directory containing %d files",{count}) end if end switch printf(1,"%s %s\n",{filename,msg}) end procedure constant tests = {"C:\\xx","C:\\not_there","C:\\Program Files (x86)\\Phix\\p.exe","C:\\Windows"} for i=1 to length(tests) do test(tests[i]) end for