Have you checked out the HELP on the FOR command? There seems to be some options available (beyond what was available in DOS) that could come in handy.
Maybe something like this (haven't tested this)?
@ECHO OFF
DIR /B /OD LPT$VPN.* > C:\TMP\MYLIST.TXT
SET LastF=
FOR /F %%i IN (C:\TMP\MYLIST.TXT) DO SET LastF=%%i
IF [%LastF%]==[] GOTO Quit
FOR /F %%i IN (C:\TMP\MYLIST.TXT) DO IF NOT [%%i]==[%LastF%] DEL %%i
SET LastF=
:Quit
DEL C:\TMP\MYLIST.TXT
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only