The reason why I don't just post code now a days is because everyone justs asks without doing any research. There is a reason there is MSDN from Microsoft. It is to tell you how to use the APIs. No offence but you have only asked for code from what I have seen without actually doing any yourself.
Why don't you try to do something yourself without constantly asking for us to just provide you with the code? It isn't that hard at all!
code:
/*
Name: GetDirectoryStructure
Purpose: Create a list of all the files from a given location on the disc
Parameters: sPath - Path to get all the files from
includePath - If true, will include the full path to the filename, if false will only display the filename
Return: An array of the files from the path
*/
function GetDirectoryStructure(sPath, includePath) {
var aFileNames = new Array();
var Win32_Find_Data = Interop.Allocate(592);
var hSearch = Interop.Call('kernel32', 'FindFirstFileW', sPath + '*', Win32_Find_Data);
var hResult;
while(hResult != 0){
if((Win32_Find_Data.ReadString(44) !== '.') && (Win32_Find_Data.ReadString(44) !== '..') && !(Win32_Find_Data.ReadDWORD(0) & 0x10)){
aFileNames.push ((includePath ? sPath : '')+Win32_Find_Data.ReadString(44));
}
hResult = Interop.Call('kernel32', 'FindNextFileW', hSearch, Win32_Find_Data)
}
Interop.Call('kernel32', 'FindClose', hSearch);
return aFileNames;
}