Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Retrieving a list of files in a particular folder

5 views
Skip to first unread message

Calleja@discussions.microsoft.com Anthony Calleja

unread,
Jun 28, 2007, 5:52:02 AM6/28/07
to
Hi,

How do I retrieve a list of files from a particular folder? I browsed
through the WINAPI Class but did not find any.

Thank you

pbovens

unread,
Jun 28, 2007, 8:26:04 AM6/28/07
to
static void PBO_ListDirFiles(Args _args)
{
FilePath filePath = "c:\\";
FileNameFilter fileFilter = ["*.*", "All files"];

FileName fileName;
int fileHandle;


;

// Get first file in directory
[fileHandle, fileName] = WinAPI::findFirstFile(strFmt("%1\\%2",
filePath, conPeek(fileFilter, 1)));

// While files found
while(fileName)
{
// ------------------------------------------
// Filepath and filename are known here...
// ------------------------------------------
info(strFmt("%1%2", filePath, fileName));

// Get next file
fileName = winAPI::findNextFile(fileHandle);
}
}
--
Best regards,

Patrick Bovens, MCBMSS
Pronamics Business Solutions
LinkedIn: http://www.linkedin.com/in/pbovens

Anthony Calleja

unread,
Jun 28, 2007, 10:54:05 AM6/28/07
to
It works, Thanks :)

vishalkohli

unread,
Dec 17, 2009, 3:26:14 AM12/17/09
to
Hey Patrick,

Thanks a lot, it worked great !!!

Regards,
Vishal Kohli

patric wrote:

static void PBO_ListDirFiles(Args _args){ FilePath filePath =

28-Jun-07

static void PBO_ListDirFiles(Args _args)
{
FilePath filePath = "c:\\";
FileNameFilter fileFilter = ["*.*", "All files"];

FileName fileName;
int fileHandle;


;

// Get first file in directory
[fileHandle, fileName] = WinAPI::findFirstFile(strFmt("%1\\%2",
filePath, conPeek(fileFilter, 1)));

// While files found
while(fileName)
{
// ------------------------------------------
// Filepath and filename are known here...
// ------------------------------------------
info(strFmt("%1%2", filePath, fileName));

// Get next file
fileName = winAPI::findNextFile(fileHandle);
}
}
--
Best regards,

Patrick Bovens, MCBMSS
Pronamics Business Solutions
LinkedIn: http://www.linkedin.com/in/pbovens

"Anthony Calleja" wrote:

Previous Posts In This Thread:

On Thursday, June 28, 2007 5:52 AM
Anthony Callej wrote:

Retrieving a list of files in a particular folder
Hi,

How do I retrieve a list of files from a particular folder? I browsed
through the WINAPI Class but did not find any.

Thank you

On Thursday, June 28, 2007 8:26 AM
patric wrote:

static void PBO_ListDirFiles(Args _args){ FilePath filePath =
static void PBO_ListDirFiles(Args _args)
{
FilePath filePath = "c:\\";
FileNameFilter fileFilter = ["*.*", "All files"];

FileName fileName;
int fileHandle;


;

// Get first file in directory
[fileHandle, fileName] = WinAPI::findFirstFile(strFmt("%1\\%2",
filePath, conPeek(fileFilter, 1)));

// While files found
while(fileName)
{
// ------------------------------------------
// Filepath and filename are known here...
// ------------------------------------------
info(strFmt("%1%2", filePath, fileName));

// Get next file
fileName = winAPI::findNextFile(fileHandle);
}
}
--
Best regards,

Patrick Bovens, MCBMSS
Pronamics Business Solutions
LinkedIn: http://www.linkedin.com/in/pbovens

"Anthony Calleja" wrote:

On Thursday, June 28, 2007 10:54 AM
AnthonyCallej wrote:

RE: Retrieving a list of files in a particular folder
It works, Thanks :)

"pbovens" wrote:


Submitted via EggHeadCafe - Software Developer Portal of Choice
Viewing Tech-Ed 2005 Content for Non-Attendees
http://www.eggheadcafe.com/tutorials/aspnet/c58c2549-108d-4ea6-bdca-a04feac064b2/viewing-teched-2005-cont.aspx

0 new messages