The following piece of code filters the source file path folder for the files with extension .docx and copies them into the destination path specified.
public void moveAllFiles()
{
fileFilter = '\\*.docx';
sourcePath = dialogSource.value();
destPath = dialogDestination.value();
[fileHandle, filename] = WinAPI::findFirstFile(sourcePath + fileFilter);
while(fileName)
{
info(strFmt("%1 %2", sourcePath , fileName));
copyFromSourceFolder = sourcePath + "\\" + fileName;
copyToDestFolder = destPath + "\\" + filename;
WinAPI::copyFile(copyFromSourceFolder, copyToDestFolder);
fileName = winAPI::findNextFile(fileHandle);
}
}
NOTE :
1) The extension format may be anything .docx .txt .xpo or anthing.
2) Here source and destination dialog fields are of type filepath.
public void moveAllFiles()
{
fileFilter = '\\*.docx';
sourcePath = dialogSource.value();
destPath = dialogDestination.value();
[fileHandle, filename] = WinAPI::findFirstFile(sourcePath + fileFilter);
while(fileName)
{
info(strFmt("%1 %2", sourcePath , fileName));
copyFromSourceFolder = sourcePath + "\\" + fileName;
copyToDestFolder = destPath + "\\" + filename;
WinAPI::copyFile(copyFromSourceFolder, copyToDestFolder);
fileName = winAPI::findNextFile(fileHandle);
}
}
NOTE :
1) The extension format may be anything .docx .txt .xpo or anthing.
2) Here source and destination dialog fields are of type filepath.
No comments:
Post a Comment