lua-users home
lua-l archive

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


----- 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

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

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

-Josh

[1] https://github.com/jjensen/luaplus51-all/tree/master/Src/Modules/filefind [2] https://github.com/jjensen/luaplus51-all/blob/master/Src/Modules/filefind/doc/us/index.md [3] https://github.com/jjensen/luaplus51-all/blob/master/Src/Modules/filefind/doc/us/reference.md