Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I tried to find something on the internet, but i came up empty handed. I need some batch scripting help.
This is the situation:
I have *.zip files in a directory, i need to find the newest file and do a command and delete the rest.i can get the list: dir /b /O:-d >> list.dat
newest file is first. but how to process it this list?Oh and it must be compatible with windows 9x/me and nt/xp versions, or as much as possible

Hi
This would work for both systems if you use the program Change.com program from PC Magazine.
It works in XP,DOS and Win9?.
What you want is easy in XP, but not Win9?.
If you can't find it, I will EMail it to you.--------------------------
CHANGE
Michael J. Mefford
Purpose Performs a rapid search-and-replace operation for text
strings and/or ASCII decimal codes throughout a file of
maximum 40,000-byte length.Format
CHANGE filespec findstring replacestringExamples
CHANGE NOGOSSIP.ART "Miss Jones" "Mrs. Smith"
CHANGE \COMM\MCI.B16 13,10 ""
-----@echo off
dir *.zip /b /o-d > File1.txt
find /n /v "" File1.txt > File2.txt
change File2.txt "[1]" "set Latest=" > nul
type File2.txt | find "set" > Latest.bat
call Latest.bat
echo Latest=%Latest%
ren %Latest% Latest.bak
if exist *.zip del *.zip
ren Latest.bak %Latest%
del File?.txt
del Latest.bat

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |