How to import multiple file from a folder?


container createListOfFiles(FilePath _path = path, FileNameType _pattern = pattern)
{
    System.Array    files;
    int             fileCount;
    int             i;
    str             nextFile;

    new InteropPermission(InteropKind::ClrInterop).assert();
    info(strfmt('Search in: %1 %2', _path, _pattern));
    listOfFiles     = connull();
    actIx           = 0;
    files           = System.IO.Directory::GetFiles(_path, _pattern);
    if (files)
    {
        fileCount =    files.get_Length();
        info(strFmt('Number of files in directory: %1', fileCount));
        for(i=0; i < fileCount; i++)
        {
            nextFile    = files.GetValue(i);
            listOfFiles += nextFile;
        }
    }
    CodeAccessPermission::revertAssert();
    info(strFmt('Files count: %1', conlen(listOfFiles)));
    return listOfFiles;
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.