I have tried using echo. (echo followed by period) to create a blank
line. I get the error:
'echo.' is not recognized as an internal or external command,
operable program or batch file.
Any ideas/suggestions would be helpful.
Thanks in advance.
Here is the bat file:
@echo off
REM HNACP00012012
if "%1"=="" goto usage
if "%2"=="" goto usage
if "%3"=="" goto usage
for /f "skip=1 delims=" %%a in ('DIR "%~1\%~2*.%3" /A-D /O-D /B /TW')
do ECHO %1\%%a
for /f "skip=1 delims=" %%a in ('DIR "%~1\%~2*.%3" /A-D /O-D /B /TW')
do del "%1\%%a"
goto xit
:usage
echo Usage: %0 directory fileprefix fileextension
echo.
echo This will change to the specified directory.
echo It will delete all files named fileprefix*.fileextension except
the one last written to.
echo.
echo Example: %0 c:\INFOSTAT\temp HISRpt txt
echo.
echo This will delete all files named HISRpt*.txt in the
c:\INFOSTAT\temp directory
echo except the one with the latest write date.
:xit
Here is what I get when I issue the command: CleanAllButLast
Usage: CleanAllButLast.bat directory fileprefix fileextension
'echo.' is not recognized as an internal or external command,
operable program or batch file.
This will change to the specified directory.
It will delete all files named fileprefix*.fileextension except the one
last wri
tten to.
'echo.' is not recognized as an internal or external command,
operable program or batch file.
Example: CleanAllButLast.bat c:\INFOSTAT\temp HISRpt txt
'echo.' is not recognized as an internal or external command,
operable program or batch file.
This will delete all files named HISRpt*.txt in the c:\INFOSTAT\temp
directory
except the one with the latest write date.