How to use timerFired() and sendTo() together properly?
Posted: Mon Jul 18, 2011 5:59 pm
Dear All,
I'm struggling with a problem for some days, but no avail. Basically I want to check a folder for time to time, and sort the arrived files based on name and creation time. I think this is what timerFired() is for – the problem is that I can't send the files out. It's not really clear to me how to turn those files to 'jobs' to move.
function timerFired( s : Switch )
{
var theDir = new Dir( "/Storage/" );
var theFiles = theDir.entryList("*.pdf", Dir.Files, Dir.Name|Dir.Time );
var theNumOfFiles = theFiles.length;
if( theNumOfFiles != 0 )
{
for( x=0 ; x<=theNumOfFiles-1 ; x++ )
{
theFile = new File( "/Storage/" + theFiles[x] );
var theTempPath = s.createPathWithName( theFile.name );
s.copy( theFile.path, theTempPath );
s.sendToSingle( theTempPath, theFile.name );
}
}
}
It's clear that this sendToSingle isn't working here. Please help me: how to use it properly, or what to do instead of this? Any help appreciated.
Kind regards,
Peter
I'm struggling with a problem for some days, but no avail. Basically I want to check a folder for time to time, and sort the arrived files based on name and creation time. I think this is what timerFired() is for – the problem is that I can't send the files out. It's not really clear to me how to turn those files to 'jobs' to move.
function timerFired( s : Switch )
{
var theDir = new Dir( "/Storage/" );
var theFiles = theDir.entryList("*.pdf", Dir.Files, Dir.Name|Dir.Time );
var theNumOfFiles = theFiles.length;
if( theNumOfFiles != 0 )
{
for( x=0 ; x<=theNumOfFiles-1 ; x++ )
{
theFile = new File( "/Storage/" + theFiles[x] );
var theTempPath = s.createPathWithName( theFile.name );
s.copy( theFile.path, theTempPath );
s.sendToSingle( theTempPath, theFile.name );
}
}
}
It's clear that this sendToSingle isn't working here. Please help me: how to use it properly, or what to do instead of this? Any help appreciated.
Kind regards,
Peter