I have created a script which looks at a folder, then creates a new output file with information as it goes
I have an output folder, within this folder are folders (which have the filename of the timestamp of when created ie 201303051158), within these folders are several files containing information that I want to load into a database.
but I want to add some more information into these data files
rem list files in folders in ts_users and output to a file 3 values, folder, filename
rem without type and full filename
del c:\ts_users\files_list.txt c:\ts_users\filelocations.txt c:\ts_users\folders_list.txt
for /r %%a in (*) do echo %%a >>c:\ts_users\files_list.txt
FOR /F "tokens=4,5 delims=\" %%a in (c:\ts_users\files_list.txt) do @echo %%a %%b %%~nb >>c:\ts_users\filelocations.txt
the output file looks like this
201303051158 eu1ptsw001.out eu1ptsw001
This information I would like to add to each line in the data files.
A line in the data file looks like this
USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME
mehmet.togrul rdp-tcp#0 2 Active 41 05/03/2013 05:05
thabo.lesame rdp-tcp#23 3 Active 6 05/03/2013 05:55
but I want it to look like this (exclude 1st line)
201303051158 mehmet.togrul rdp-tcp#0 2 Active 41 05/03/2013 05:05 eu1ptsw001
201303051158 thabo.lesame rdp-tcp#23 3 Active 6 05/03/2013 05:55 eu1ptsw001
is using a batch file the best way to do this?