appending multiple strings to the end a file

March 18, 2011 at 07:01:32
Specs: Windows XP
hey i have lots of .txt files with content such as this:

Directory C:\AH\Desktop Backups\2010-02-27

26/08/2009 09:53 AM 4,707,780 101_0159.AVI
26/08/2009 09:54 AM 6,794,386 102_0213.AVI
2 File(s) 11,502,166 bytes

Directory C:\AHA\Picture Backups\2009-03-30

19/10/1998 10:22 AM 593,447 BADCHILD.avi
1 File(s) 593,447 bytes

----------------------------------------------

I need to append the total at the bottom so it looks like this:

Directory C:\AH\Desktop Backups\2010-02-27

26/08/2009 09:53 AM 4,707,780 101_0159.AVI
26/08/2009 09:54 AM 6,794,386 102_0213.AVI
2 File(s) 11,502,166 bytes

Directory C:\AHA\Picture Backups\2009-03-30

19/10/1998 10:22 AM 593,447 BADCHILD.avi
1 File(s) 593,447 bytes

11,502,166 bytes
593,447 bytes

------------------------
I just need all the numbers between Files(s) and bytes to be appended to the end of the script, they're all in the same directory and have different file names. the trick is to loop the script so it does this for every file in a directory. Any help would be awesome


See More: appending multiple strings to the end a file

Report •


#1
March 18, 2011 at 07:09:33
I wrote a script that does what i need but as you can see I have to specify each time the file name and where to append it. i tried *.txt but ran into problems.

for /f "tokens=2*" %%a in ('findstr /c:"File(s)" "MASTERFILE.txt"') do (
for /f "tokens=2 delims=\" %%c in ("%%b") do -

Echo %%b
) >> MASTERFILE.txt


Report •
Related Solutions


Ask Question