Skip to Content
avatar image
Former Member

Pick Single file from FTP

Hi All ,

We have a requirement that we have to poll from one FTP Folder , that particular folder can have multiple file with same file name but with different time stamps .

We have to pick only the latest file while ignoring all the other files present there .

Any Suggestion ?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Aug 13, 2015 at 06:58 PM

    hello,

    there is no standard format in adapter to do this, we have to follow work around.

    write OS script for this, below are the links for the same

    If unix you can see an example script here:

    http://www.computing.net/answers/dos/batch-file-to-rename-files-by-date/5517.html

    If windows an example here:

    http://en.kioskea.net/forum/affich-87157-finding-and-using-file-date-in-batch-command

    You may need to change slightly to fit your exact requirements. But this would make you to start. Else you can also google to get the script. Here is one link:

    http://www.google.com/#hl=en&source=hp&q=scripttorenamefileshavingtodaysdate&aq=f&aqi=m1&aql=&oq=&gs_rfai=CRE9SwTMsTNjiDpzGhgTm65iFCwAAAKoEBU_QC2i-&fp=e0fa4b5da4f245a4

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 13, 2015 at 07:26 PM

    May be better way is to discuss with your sender and see if they can overwrite instead of creating a new file every time.

    if that's not possible,you may want to try something like below(if you don't want to deal with scripts),

    Trigger/Request(Proxy/dummy file) -> mapping (File lookup java UDF -> read content) -> receiver.

    In the file lookup UDF, you can handle

    -> getting the last modified file

    ->setting the other files to read only/delete them

    Add comment
    10|10000 characters needed characters exceeded