Forfiles version you use is not native XP command. It's an older version of the utility, which was originally distributed with one of the
W2K Resource Kits (I think it goes even to NT Resource kit, although I'm not sure). There is nothing wrong using that on XP per se , but if you look closely into it's syntax, it says (emphasis mine):
-d[+|-][DDMMYY|DD] Select files with date >= or <=DDMMYY (UTC)
or files having date >= or <= (current date - DD days)
Note UTC in the description. This means
(1.1) forfiles uses different time stamps that you think it does - unless your system time is UTC (no offset), no daylight savings.
This will be probably easier with an example. I'm UTC+1, daylight savings time.
(today's date - 2012-09-19)
- Create file and do a dir:
2012-09-19 00:14 5 zzz_utc.txt
it has today's date, so it should not be selected by forfiles,let's check it:
FORFILES -pc:\temp -mzzz_utc.* -d-1 -c"CMD /C Echo @FILE"
But it does get selected! Why? Let's look at file UTC times (following command is run from powershell):
ls .\zzz_utc.txt |select LastAccessTime,LastAccessTimeUTC
2012-09-19 00:15:11 2012-09-18 22:15:11
As you can see, TimeUtc - the one used by
(1.1) forfiles is from yesterday! That's why it gets selected by the tool.