Scanning directories for new files?
Jon Clements
joncle at googlemail.com
Tue Dec 21 14:34:00 EST 2010
On Dec 21, 7:17 pm, Matty Sarro <msa... at gmail.com> wrote:
> Hey everyone.
> I'm in the midst of writing a parser to clean up incoming files,
> remove extra data that isn't needed, normalize some values, etc. The
> base files will be uploaded via FTP.
> How does one go about scanning a directory for new files? For now
> we're looking to run it as a cron job but eventually would like to
> move away from that into making it a service running in the
> background.
Not a direct answer, but I would choose the approach of letting the
FTP server know when a new file has been added. For instance:
http://www.pureftpd.org/project/pure-ftpd -
"Any external shell script can be called after a successful upload.
Virus scanners and database archiveal can easily be set up."
Of course, there's loads more servers, that I'm sure will have
callback events or similar.
Although, yes, the monitoring the file system is completely possible.
hth
Jon.
More information about the Python-list
mailing list