Creating 50K text files in python

Peter Otten __peter__ at
Wed Mar 18 14:35:42 CET 2009

venutaurus539 at wrote:

> Hello all,
>           I've an application where I need to create 50K files spread
> uniformly across 50 folders in python. The content can be the name of
> file itself repeated 10 times.I wrote a code using normal for loops
> but it is taking hours together for that. Can some one please share
> the code for it using Multithreading. As am new to Python, I know
> little about threading concepts.
> This is my requiremnt:
> C:\TestFolder....
> That folder contains 5 Folders.. Folder1, Folder2, Folder3.....
> Folder5
> Each folder in turn contains 10 folders:
> and Each of those folder contains 1000 text files.
> Please let me know if you are not clear.
> Thank you,
> Venu Madhav.

I've just tried it, creating the 50,000 text files took 17 seconds on my not
very fast machine. Python is certainly not the bottleneck here.


More information about the Python-list mailing list