How check for a new file on a ftp-server

Hi there,

I want to write a linux shellscript that checks a specific folder on a specific FTP-server whether there are new files or not. If there are new files I want to download them to a local directory (to gain access for an local application to these files). The problem is that the files I suggest to find on that FTP are too big for downloading and comparing them with local files.

Do you have an idea how I can check via a ftp-connection whether there are new files or not? How can I check and compare those files?

BTW:
I use "ftp" with a self-produced .ftp-file which i use as inputfile that gives the commands to the ftp prrogram. The rest of the script is finished but the check-action is missing...

Thanks for your help

Do you know about wget and its ability to maintain a directory listing (--no-remove-listing)?

use ls -l within ftp. You don't have to download the file from ftp and check for that

and compare the filesize with the local copy - that should give an hint

Ok, the situation changed a bit:

  • I have to connect to a ftp-server
  • There are files of .csv-type
  • I need to download all of these .csv-files
  • After each download I have to put a flag-file for the download to the server (e.g. if I download "xyz-2008-10-12.csv" I have to upload a file called "xyz-2008-10-12.csv.ok" with the size of 0 kb)
    (- There is a script running on the ftp-server that moves all files which have a .ok-flagfile to an archive folder)

How can I get a list of the filenames on ftp the easiest way, to touch the new 0 kb-ok-files?

Thanks..