Tuesday, January 26, 2010

Read All Files inside a directory

void FindAllCSV()
{
#Evat_NL
#File

Filename baseFolder;
Filename csvFilename;
Filename foundBaseFileName;
Filename foundFileName;
container mainFolder, subFolder, fileContainer;
boolean filesFoundMainFolder = true;
boolean filesFoundSubFolder = true;
int apiResult;

int setCurrentFolder (Filename _filename = '')
{
;
return WinAPI::setCurrentDirectory(_filename);
}

;
baseFolder = "C:\\TEST\\";

apiResult = setCurrentFolder(SysTreeNode::duplicatePathDelimiters(baseFolder));
mainFolder = WinAPI::findFirstFile("*.*");
foundBaseFileName = conpeek(mainFolder, 2);
while (filesFoundMainFolder)
{
if (foundBaseFileName != #currentFolder &&
foundBaseFileName != #upFolder &&
foundBaseFileName != '')
{
csvFilename = baseFolder + foundBaseFileName;
this.parmFileName(csvFilename);
This.readCSVfile();
}

apiResult = setCurrentFolder(SysTreeNode::duplicatePathDelimiters(baseFolder));
foundBaseFileName = WinAPI::findNextFile(conpeek(mainFolder, 1));
filesFoundMainFolder = foundBaseFileName ? true : false;
}
}

1 comment:

Anonymous said...

adesso vediamo se va...

ciao by Michele di Lavis :-)