VINDICTA
Filesystem · Function
Bunni.fun
ChocoSploit
Cryptic
Potassium
Seliware
SirHurt
Solara
Velocity
Volcano
Volt
Wave
Xeno

listfiles

Returns a list of all files and folders in a directory.

function listfiles(path: string): {string}

Synopsis

How it works

Enumerates all files and subdirectories in the given workspace folder. Uses the Win32 FindFirstFileA/FindNextFileA API to iterate directory entries:
WIN32_FIND_DATAA fd;
HANDLE h = FindFirstFileA(path + "\*", &fd);
while (FindNextFileA(h, &fd)) {
  if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
    results.push(fd.cFileName + "/");
  else
    results.push(fd.cFileName);
}
FindClose(h);
Returns full relative paths from the workspace root. Does not recurse into subdirectories — only lists the immediate children.

Usage

List workspace root
for _, path in ipairs(listfiles(".")) do
	print(path, isfolder(path) and "[dir]" or "[file]")
end

Parameters

path string
Path to the folder to list.

Returns

{string} Array of full paths for each entry.