how to call external functions from python

Peter Hansen peter at engcorp.com
Thu Nov 29 04:50:10 CET 2001


weeang wrote:
> 
> Peter Hansen wrote in message:
> > weeang wrote:
> > >
> > > i need help on the following:
> > >
> > > 1) find all files in inbox directory and zip them
> > > 2) move the zipped file to outbox
> > > 3) copy the zipped file to a remote directory
[...]
> My general objectives are:
> To zip all files in a directory and copy the zipped file to a remote
> directory.
> 
> The design is as follows, i.e. simulating a ms outlook functionality:

I'm going to ignore that comment about Outlook, because while
it does perform some functions that are in some ways similar
to what you are talking about, it is an *email* program and
you don't seem to be talking about email at all (right?).
There are many ways to move files around, and email is
only the most complicated (in this case at least, where 
you want to drop the files directly into a remote folder).

> 1)Zip all the files in a local 'inbox' directory
> 2)Move the zipped file to local 'outbox' directory
> 3)Copy the zipped file to a remote directory
> 4)Moving the zipped file to a local 'sent' directory
> 
> I hope I have made myself clear??

I think so, but the terms "inbox" and "outbox" are
so loaded with email-related meanings, and you mention
MS Outlook but don't seem to really be talking about
anything related to Outlook, that I'll just trust
you really aren't talking about email at all.

It sounds like you want to read about the following
modules in the standard library:

zipfile 
os
possibly shutil
possibly ftplib

Note that by using os.system() you could perhaps simply
call an external zip program and skip zipfile.

How do you plan to get the files from the local machine
to the remote directory? FTP? SSH? Copying across a
local area network?  (Or did you really plan to use
email for this?  In which case you want smtplib too.)

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com



More information about the Python-list mailing list