> -----Original Message----- > From: Linux on 390 Port [mailto:[EMAIL PROTECTED] On > Behalf Of David Boyes > Sent: Tuesday, November 06, 2007 8:26 AM > To: [email protected] > Subject: Re: FTP client : can I download newer files only and > skip if already exist on local site? > > > > from a Linux SLES9X using "ftp client" and i.e. " > mget *.txt " > > all files from remote site are downloaded and replaced (with today > date) > > if already present too. > > My scope is to download only the newer or not present on local > site > > ans skip when they already exist. > > The FTP specs don't provide this kind of function on an interoperable > basis. You'll have to do this in three steps: > > 1) get the list of files that exist on the remote site. > 2) find the differences > 3) retrieve the updated files > > If you use ncftp as the Linux client, you can script the > session fairly > easily. Step 1 is to connect, authenticate, and get a list of > the files > on the remote system via DIR (note that you'll have to deal > with all the > variations in listing format; FTP doesn't normalize this) > > Step 2, get the listing of the current files and run diff to get the > changes. > > Step 3, parse the diff, and create a list of files to get, then feed > that list to ncftp.
Rather that doing a "diff" of the directory listing, I think it would be nice if the server containing the files also contained a sha1sum file containing the sha1sum of all the files in the directory. The client could then just download the sha1sum file from the server. It would then compare that sha1sum file with its version of the sha1sum file (diff?). The client could then download all "new" files and all files whose sha1sum has changed. As a plus, once downloaded, the client to do another sha1sum to verify that the transfer occurred successfully. (well, at least for BINARY downloads). Of course, this is more overhead than a simple comparison of a NLST. -- John McKown Senior Systems Programmer HealthMarkets Keeping the Promise of Affordable Coverage Administrative Services Group Information Technology The information contained in this e-mail message may be privileged and/or confidential. It is for intended addressee(s) only. If you are not the intended recipient, you are hereby notified that any disclosure, reproduction, distribution or other use of this communication is strictly prohibited and could, in certain circumstances, be a criminal offense. If you have received this e-mail in error, please notify the sender by reply and delete this message without copying or disclosing it. ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390
