I'd like to know how to create a batch file that will rename a particular file to the current date once it reaches a certain size limit. For example, "logfile.log" reaches 50MB today, so it gets renamed to 10-2-08.log instead.
So far I've been working with the attached script that I found somewhere else, but every time I run it I get this message:
"No parameter given, or file does not exist, or file size is less than 50 MB" (Obviously that's the message I gave it, but why is it not working?)
Thanks to anyone who can help.
if "%*"=="" goto Error
if not exist "%*" goto Error
for /F %%a in ('echo %*') do if %%~za LSS %limit% goto error
for /F "tokens=2" %%a in ('echo %date%') do set MyDate=%%a
ren logfile.log "batch-%MyDate:/=%.*
echo No parameter given, or file does not exist,
echo or file size is less than 75 MBytes.