On 09.04.2013 08:28, Auric__ wrote:
> > Five By Five wrote (in comp.os.msdos.programmer):
> >
>> >> I am trying to write a CMD batch file script that concatenates the text
>> >> (lines) of ALL BUT LAST ONE the files (Apache logs) in time order.
>> >>
>> >> 1. Assume the batch (.bat) file is in the same directory
>> >> 2. Assume the files are named "prefix-ddmmmmyyyy.log" where 'prefix-' and
>> >> '.log' are unvarying characters in the file name.
>> >>
>> >> How would that be done?
If the file dates are in the same order than the dates
in the file name, you can use:
@echo off
set list=nul
set last=
for /f %%i in ('dir /b /od *.log') do (
if defined last call set list=%%list%%+%%last%%
set last=%%i)
copy /b %list% all.txt