Python or Java or "X" from me and my little job

Cedric Adjih adjih at technologist.com
Tue Sep 14 12:26:31 EDT 1999


Ben Thomas <bthomas at trey-industries.com> wrote:
> Actually I just want to
> 1)get current date and come up with its string like: 01251999
> 2)zip some files and name the archive 01251999
> 3)ftp the archive off site
>
> this is my first task but I know there will be others. It isn't hard to code
> I am just new to Python.

  Well if all you need to do is that simple, maybe sticking
with shell scripts would do. For instance:

#! /bin/sh
FILENAME=archive-`date +"%Y-%m-%d"`.zip
FILELIST=`find /home/mydir -type f -mtime 1` 
zip -r $FILENAME $FILELIST || exit 1
ncftpput -u thomas -p MYPASSWRD ftp.myserver.net /home/thomas $FILENAME

You need to read the man pages for each of the programs, and are better
using the standard "tar" + "gzip" if you compress files for Unix only
(using something like "tar -czvpf $FILENAME $FILELIST")
You can do more complicated change checking using 'md5sum', 'sort',
'comm' etc... 
Only after that you might want to switch to Python :-)

-- Cedric
Not speaking for INRIA.





More information about the Python-list mailing list