Why it is a illegal guard expression?

钱晓明 kyleqian@REDACTED
Wed Feb 24 04:42:03 CET 2010

Hi, I am a newer of erlang. I wrote a module to find all files(no directory)
under a directory, including its subdirectory:

    {ok, FileList} = file:list_dir(Path),
    process_filelist(FileList, []).

process_filelist([File|FileList], Files)->
       filelib:is_dir(File) ->
        {ok, NewFileList} = file:list_dir(File),
        process_filelist(NewFileList, Files);
       true ->
        process_filelist(FileList, [File|Files])
process_filelist([], Files) ->

But I fail to compile this file, because " filelib:is_dir(File) ->" is
illegal guard expression. So Why it is illegal? What should I write?
Thanks for your help!

More information about the erlang-questions mailing list