JornyO wrote:
> I tried the code you suggested by copying and pasting it into a text file and
> then changing the extension to .bat. I tried running it twice, once by
> double-clicking on the Batch file icon, and once from Command Prompt. Both
> times I got the same result: a 1KB file called Collect.txt in C:\ with a
> single line of text that says: "Snapshot taken on 03/15/2007 at 9:00" That
> batch file was in the parent folder whose subfolders contain the text files I
> want copied into a single file.
>
> Did I miss something? Perhaps my limited knowledge of coding and scripting
> is making blind to something that ought to be obvious.
>
>
>
> "Pegasus (MVP)" wrote:
>
> @echo off
> set HomeFolder=c:\temp
>
> Echo Snapshot taken on %date% at %time:~0,5% > c:\Collect.txt
> call :Sub %HomeFolder%
> for /F "tokens=*" %%* in ('dir /s /b /ad') do call :Sub %%*
> notepad c:\Collect.txt
> goto :eof
>
> :Sub
> pushd "%*"
> if exist *.txt (
> echo. >> c:\Collect.txt
> echo Folder=%* >> C:\Collect.txt
> echo ==================== >> c:\Collect.txt
> for %%b in (*.txt) do (
> echo %%b >> c:\Collect.txt
> type "%%b" >> c:\Collect.txt
> )
> )
> popd
>
While you're waiting for Pegasus to explain the esoterica of
command-line programming, try editing the second line of your batch file
to read:
set HomeFolder=c:\Data
(assuming that C:\Data is parent folder whose subfolders contain the
text files you want copied into a single file; otherwise, use the
correct folder name)
--
Lem MS MVP -- Networking
To the moon and back with 64 Kbits of RAM and 512 Kbits of ROM.
http://en.wikipedia.org/wiki/Apollo_Guidance_Computer