Script to count files in a folder

Diez B. Roggisch deets at nospam.web.de
Mon Oct 23 10:06:54 EDT 2006


umut.tabak at student.kuleuven.be wrote:

> 
> 
> On Oct 23, 3:11 pm, "Fredrik Lundh" <fred... at pythonware.com> wrote:
>> umut.ta... at student.kuleuven.be wrote:
>> > A batch file creates this file and deletes that file in the same loop.
>> > This file is intended to start the reading of an input file. After it
>> > is read batch file deletes this file automatically and on the next loop
>> > it  will be written and deleted again. With this script I have to count
>> > the occurences of the file on this specific folder.what does "count"
>> > mean here?
>>
>> do you want to check if the file is there, or how many times a file with
>> that name has been created ?
> 
> Yes I would like to check how many times that specific file is created.
> so count is the number of times of creation.

As Fredrik said - not really possible, at least not with standard python.
For Linux, you might be lucky using the python LUFS module:

http://www.freenet.org.nz/python/lufs-python/

But you being a beginner, I guess that is a bit over your head. Trying to
change the behaviour of the batch skript, writing out the information you
need is the more reasonable approach.

Diez



More information about the Python-list mailing list