AX查找文件遍历文件夹

static void lookupFiles(Args _args)
{
    void findFile(str path,str filesExt,boolean subFolder=false)
    {
        int         hdl;
        Filename    filename;
        ;
        [hdl, filename] = WinAPI::findFirstFile(path+filesExt);
        while (filename)
        {
            info(path+filename);
            filename = WinAPI::findNextFile(hdl);
        }
        
        if(subFolder)
        {
            [hdl, filename] = WinAPI::findFirstFile(path+"*");
            while (filename)
            {
                if(filename != "." &&filename != ".."&&WinAPI::folderExists(path+filename))
                    findFile(path+filename+"\\",filesExt,subFolder);
                filename = WinAPI::findNextFile(hdl);
            }
        }
        WinAPI::findClose(hdl);
    }
    ;
    findFile("D:\\","*.xlsx",true);
}

猜你喜欢

转载自www.cnblogs.com/xtwkh1973/p/11001514.html