summaryrefslogtreecommitdiffstats
path: root/nselib/lfs.luadoc
blob: 60d436d7c1c32c33778452c1bdb512a1b7026a67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
-- The <code>lfs</code> module provides Nmap with a portable interface to file
-- system functions that are missing in the standard Lua libraries. The module
-- is a port of the LuaFileSystem module which was written as part of the
-- Kepler Project.
--

module "lfs"

--- Returns a directory iterator listing the contents of the given path
--
-- Each time the iterator is called with dir_obj it returns a directory entry's
-- name as a string, or nil if there are no more entries.
--
-- @param path string containing the directory to list
-- @return iterator function returning the next file or nil when done
-- @usage for f in lfs.dir("/tmp") do print("file:", f) end
function dir(path)

--- Creates a hard or symbolic link to a file
--
-- @param filepath string containing the object to link to
-- @param linkname string containing the name of the link
-- @param symbolic [optional] boolean true if link is symbolic
-- @return Status (true or false)
-- @return Error string (if status is false).
function link(filepath, linkname, symbolic)

--- Creates a new directory.
-- The parent directory has to exist otherwise the operation will fail
--
-- @param path string containing the directory name to create
-- @return Status (true or false)
-- @return Error string (if status is false).
function mkdir(path)

--- Removes an existing directory.
-- The directory has to be empty, otherwise the operation will fail
--
-- @param path string containing the directory name to remove
-- @return Status (true or false)
-- @return Error string (if status is false).
function rmdir(path)

--- Returns the OS specific directory path separator.
--
-- @return sep string containing the path separator
function get_path_separator()