On Wed, 17 Mar 2010 11:34:16 +0100 Jan Stary <h...@stare.cz> wrote: > http://marc.info/?l=openbsd-misc&m=126678113118214&w=2 > > Has the format of > ftp://ftp.openbsd.org/pub/OpenBSD/snapshots/i386/index.txt > changed again? It seems to be 'ls -l' now. >
Hi Jan, I think this is the second time I've seen you mention the format of the index.txt file... so it seems you're "mistakenly" trying to parse index.txt to get the file/path names of the stuff you need to download. (pardon me if my mind reading skills are slightly off) ----------------------------------------------------------- #!/bin/ksh ftp_host="ftp.openbsd.org" basepath="pub/OpenBSD/snapshots" arch=`uname -m` ftp -i -n <<EOF >>ftp.log open $ftp_host user anonymous none@ nlist $basepath/$arch ftp.files EOF # exclude floppy*.fs and *.iso for FNAME in `grep -v -e "\.iso" -e "\.fs" ftp.files | sed -e "s:$basepath/$arch/::"`; do if [[ -z $FLIST ]]; then FLIST="$FNAME"; else FLIST="$FLIST FNAME" fi done ----------------------------------------------------------- NOTE the "for ..." is wrapped, The result is $FLIST contains just a list of all the file names of the stuff on the ftp server in the given directory excluding the *.fs and *.iso files. The real magic in the above is in the "nlist" command of ftp, and you don't necessarily need to do it in a shell script. perl would work equally well. If my mind reading skills are off, and you're trying to check the time stamp of files on the ftp server, then check out the ftp "modtime" command, and point it at the SHA256 file (that "should" be there). In other words, the format of "index.txt" should not matter since there are better ways to get the information you want. jcr