CheckFileDates: Commander.CommandProc = {
start, end: GMT;
arg: ROPE;
dir: ROPE;
count: CARDINAL ¬ 0;
noVersion, latest: PATH;
OneFile:
PFS.InfoProc ~ {
thisGMT: GMT;
thisV: PFSNames.Version;
found, dateRope: ROPE;
IF fileType =
PFS.tDirectory
THEN {
PFS.EnumerateForInfo[PFSNames.Cat[fullFName, star], OneFile];
RETURN;
};
thisGMT ¬ uniqueID.egmt.gmt;
IF ( count ¬ count + 1 )
MOD 100 = 0
THEN {
IF count MOD 1000 = 0 THEN cmd.out.PutF1[" (%g)", [cardinal[count]] ]
ELSE cmd.out.PutRope["."];
Process.CheckForAbort[];
};
IF BasicTime.Period[from: start, to: thisGMT] < 0 THEN RETURN[TRUE];
IF BasicTime.Period[from: thisGMT, to: end] < 0 THEN RETURN[TRUE];
** check if this is the latest version of this file
dateRope ¬ DFUtilities.DateToRope[[explicit, thisGMT]];
thisV ¬ PFSNames.ShortName[fullFName].version;
found ¬ PFS.RopeFromPath[fullFName];
latest ¬ PFS.FileLookup[PFSNames.SetVersionNumber[fullFName, [highest]], NIL];
IF PFSNames.EqualVersions[thisV, PFSNames.ShortName[latest].version]
THEN {
see if file is in the version maps
mapList: VersionMap.MapList ¬ VersionMap.MapListForName[found];
mnList: VersionMap.MapAndNameList ¬ VersionMap.ShortNameToNames[mapList, VersionMap.ShortName[found]];
IF mnList =
NIL
THEN
cmd.out.PutF["\n%g (%g - not in version map)\n", [rope[found]], [rope[dateRope]] ]
ELSE cmd.out.PutFL["\n **%l%g%l (%g)\n", LIST[[rope["b"]], [rope[found]], [rope["B"]], [rope[dateRope]]] ]
}
ELSE cmd.out.PutF["\n%g (%g - not latest)\n", [rope[found]], [rope[dateRope]] ];
RETURN[TRUE];
};
start ¬ Convert.TimeFromRope[arg ¬ CommanderOps.NextArgument[cmd]];
end ¬ Convert.TimeFromRope[arg ¬ CommanderOps.NextArgument[cmd]];
dir ¬ CommanderOps.NextArgument[cmd];
cmd.out.PutF["\n***Starting CheckFileDates at %g, looking for dates between %g and %g\n", [time[BasicTime.Now[]]], [time[start]], [time[end]] ];
PFS.EnumerateForInfo[PFSNames.Cat[PFS.PathFromRope[dir], star], OneFile];
cmd.out.PutF["\n***Done with CheckFileDates at %g (%g files examined)\n", [time[BasicTime.Now[]]], [cardinal[count]] ];
};
Commander.Register["CheckFileDates", CheckFileDates, "syntax is start end dirToEnumerate"];