lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


----- Original Message -----
From: Joshua Jensen
Date: 12/16/2011 3:00 AM
----- Original Message -----
From: Xavier Wang
Date: 12/16/2011 2:46 AM
I have try to find a lua module that acts like GNU find, it can
enumerate files in a directory, and makes some filter on it:

find "." :name ".svn" :prune()
     :OR():print()

or something like it.
The filefind module [1] may do what you want [2] [3]:

require 'filefind'

-- Just files, excluding .svn directories.
for entry in filefind.glob('**@-.svn/') do
    print(entry.filename)
end

[1] https://github.com/jjensen/luaplus51-all/tree/master/Src/Modules/filefind
Also, just to add this, the filefind module is very high performance, especially on Windows. LuaFileSystem does not collect file information from the FindFirstFile/FindNextFile iteration calls. It asks separately for the file stats. It has been my experience that this is VERY costly on Windows.

-Josh