Results 1 to 3 of 3
  1. #1
    s3c
    s3c is offline Member
    Join Date
    Dec 2012
    Posts
    2
    Rep Power
    0

    Default FTPClient listFiles - how to get list order by name or date

    Hi,

    I need to use FTPClient.listFiles or something alike, that let's me choose the order of which files are iterated.

    I've searched the web quite a bit and couldn't find anything regarding this subject.

    Thanks in advance

    regards

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,439
    Rep Power
    18

    Default Re: FTPClient listFiles - how to get list order by name or date

    I don't think you can specify an order.
    All the ftp 'ls' does is call the equivalent to 'ls' on the server, so you get it back in whatever order the server deems appropriate.

    If you need to present the FTPFile objects in a particular order for later processing in the app then I would suggest using Arrays.sort and provide a suitable Comparator to sort your FTPFile[].
    Please do not ask for code as refusal often offends.

  3. #3
    s3c
    s3c is offline Member
    Join Date
    Dec 2012
    Posts
    2
    Rep Power
    0

    Default Re: FTPClient listFiles - how to get list order by name or date

    Quote Originally Posted by Tolls View Post
    I don't think you can specify an order.
    All the ftp 'ls' does is call the equivalent to 'ls' on the server, so you get it back in whatever order the server deems appropriate.

    If you need to present the FTPFile objects in a particular order for later processing in the app then I would suggest using Arrays.sort and provide a suitable Comparator to sort your FTPFile[].
    Thanks for the reply, That was what i was thinking, but i wasn't sure.

    I will look into ordering the results with "Arrays" or "List".

    regards

Similar Threads

  1. having trouble with FTPClient
    By mniz13 in forum Advanced Java
    Replies: 1
    Last Post: 06-24-2011, 08:29 PM
  2. [ask] listfiles from folders inside a folder
    By goklien in forum New To Java
    Replies: 3
    Last Post: 05-12-2011, 04:29 PM
  3. FTPClient need to download?
    By dudejonne in forum New To Java
    Replies: 8
    Last Post: 11-06-2009, 04:40 PM
  4. adding a variable in order to a list
    By Jrr in forum New To Java
    Replies: 2
    Last Post: 11-19-2007, 01:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •