building a large file

Steve Holden sholden at holdenweb.com
Sun Apr 15 11:36:45 EDT 2001


<ben at co.and.co> wrote ...
> Andrew Dalke <dalke at acm.org> wrote:
> > Emile van Sebille asked:
> >>Doesn't tar do exactly this?
> >
> > where "this" was defined by Thomas Duterme to mean:
> >>> for x in os.listdir('.'):
> >>>     os.system('cat '+x+' >> mylargefile)
> >
> > No, tar doesn't do that because it adds data needed to
> > extract each file.  On the other hand, cat does:
> >
> > cat * > mylargefile
> >
> > though this won't read the dotfiles.
>
> But $ cat .* * > mylargefile does.
>
Danger, Will Robinson. This will include directories (current and parent, .
and .. respectively) in your match, probably not a good idea. I seem to
remember that the correct pattern should be

$ cat .??* * > mylargefile

but I have no doubt this too will prove to be wrong in some subtle way I
have omitted to consider.

regards
 Steve






More information about the Python-list mailing list