Chris wrote: > On Mar 14, 8:36 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: >> On Thu, 13 Mar 2008 21:28:18 -0700 (PDT), jai_python >> <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: >> >>> hi frenz I Need a Python Script For read multiple files(.txt) from a >>> folder and write it in a single text file.... >> If you are on windows, just open a command prompt and use the >> standard copy command... >> >> C:\Documents and Settings\Dennis Lee Bieber>copy /? ... > If you want to go that route you could also do: type *.txt > > output_file.txt
On Unix, cygwin, etc: cat dir/*.txt > output.txt Or if you need "deep" copy: cat $(find dir -name '*.txt') > output.txt You could write a portable solution in Python (as in Martin Laloux's post), but most modern command-line environments have similar (but not identical) support for globbing and redirecting files. If you're getting the glob pattern from a user, they may expect subtly platform-dependent behaviors, in which case portability might not as important as native feel. -- http://mail.python.org/mailman/listinfo/python-list