| Document Path: | Home Page / Command Tools / SyncScan / CompareDirectory Callback |   |
The CompareDirectory method of the App object calls this Callback function:
function CompareCallback(directory_Flag, file1_Object, file2_Object)
{
}
function CompareCallback(dirFlag, fo1, fo2)
{
switch(dirFlag)
{
case 2:
app.Print("\nStart comparing " + fo1.FullPath + " with " + fo2.FullPath + "\n");
case -2:
app.Print("\nFinish comparing " + fo1.FullPath + " with " + fo2.FullPath + "\n");
break;
case 0:
if(fo2.Valid)
{
var r=fo1.LastWriteTime.Compare(fo2.LastWriteTime);
if(r>0)
{
app.Print(fo1.FullPath + " is newer than " + fo2.FullPath+"\n");
}
else if(r<0)
{
app.Print(fo1.FullPath + " is older than " + fo2.FullPath+"\n");
}
else
{
//....
}
break;
case 1:
app.Print("Begin comparing sub-directory " + fo1.FullPath + " with " + fo2.FullPath + "\n");
break;
case -1:
app.Print("End of comparing sub-directory " + fo1.FullPath + " with " + fo2.FullPath + "\n");
break;
}
if(app.kbhit()) //user pressed a key?
{
var ch=app.getch(); //Read the key without displaying it
if(ch==27) //If the key is ESC
{
app.Print("*** Abort ***\n");
return(-1);
}
}
}