I have 2,300 text files with filenames that currently do not include the information needed, but must continue to retain their existing file name after I append content from the text files to the names. The text file content is structured and the code should grab the following content out and append to the existing filename.
Short Name = John Doe
I only want John Doe to be pulled from the content and appended to the file name. All the existing file names are unique and should remain the same, I'm just appending whatever is after "=" to the file name.
All the existing questions involve renaming the existing file, appending non-changing text to file names, or some variation thereof. It'd be great if I could have the files go into a separate directory after appending, but not required (I'll be working off copies anyway). Somehow no one is keeping the existing file name and appending content!
Renaming file based on its content using Batch file
How to Append to existing file name within a batch command in a for loop
@echo off
setlocal
for /F "tokens=2 delims==" %%a in ('findstr /I "LastLogedUser=" something.txt') do set "uniuser=%%a"
echo User is: %uniuser%
copy fpr_log.txt "c:\fpr_log%uniuser%.txt"
endlocal
@echo off
for %%a in (*.txt) do type append_me >> %%a
I found the code above, but the problem is it doesn't append and I only found a snippet of append code.