Friday, June 8, 2012

List nama-nama file dalam folder

static void Test_ListDirFiles(Args _args)
{
    FilePath        filePath        = "d:\\Documents\\Project";
    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);
    }
}

No comments:

Post a Comment