Here's my goal: Use a batch file to redirect the contents of a log file into a new log file that the batch has created.
e.g.:
Code: Select all
type logfile.log >> batchlog.log
Here's why it's difficult: the current running directory is %windir%\Temp, but the relevant subdirectories are not static in name. They have the a date/time stamped onto a common prefix: e.g. FOLDERNAME-yyyymmdd-HHmmss.log
So, I need to parse through these folders for a file name that is similar in structure: FILENAME-yyyymmdd-HHmmss.log
I'm not necessarily beholden to a FOR loop, nor even a batch file per se, but this is the path I've taken thus far.
Here's what I've got so far (which doesn't seem to work!):
Code: Select all
for /d /r %%X in (C:\Windows\Temp\LOGDIRECTORY-*) do type %%X\LOGNAME* >> \\share\path\BATCHLOG.log 2>&1
Any and all help will be appreciated!