How to list directory content of remote FTP, recursively

后端 未结 5 1258
再見小時候
再見小時候 2021-02-02 10:56

After downloading files from a remote UNIX FTP server, you want to verify that you have downloaded all the files correctly. Minimal you will get information similar to \"dir /s\

相关标签:
5条回答
  • 2021-02-02 11:25

    Sadly this was written for Unix/Linux users :/

    Personally, I would install CYGWIN just to get Linux binaries of LFTP/RSYNC to work on windows, as there appears not to be anything that competes with it.

    As @zadok.myopenid.com mentioned rsync, this appears to be a windows build for it using CYGWIN ( if you manage to be able to get ssh access to the box eventually )

    http://www.aboutmyip.com/AboutMyXApp/DeltaCopy.jsp

    Rsync is handy in that it will compare everything with check sums, and optimally transfer partial change blocks.


    If you get CYGWIN/Linux:

    http://lftp.yar.ru/ is my favorite exploration tool for this.

    It can do almost everything bash can do, albeit remotely.

    Example:

    $ lftp mirror.3fl.net.au
    lftp mirror.3fl.net.au:~> ls                          
    drwxr-xr-x  14 root     root         4096 Nov 27  2007 games
    drwx------   2 root     root        16384 Apr 13  2006 lost+found
    drwxr-xr-x  15 mirror   mirror       4096 Jul 15 05:20 pub
    lftp mirror.3fl.net.au:/> cd games/misc
    lftp mirror.3fl.net.au:/games/misc>find
    ./
    ./dreamchess/
    ./dreamchess/full_game/                                                      
    ./dreamchess/full_game/dreamchess-0.2.0-win32.exe                                      
    ./frets_on_fire/
    ./frets_on_fire/full_game/                                                      
    ./frets_on_fire/full_game/FretsOnFire-1.2.451-macosx.zip                                  
    ./frets_on_fire/full_game/FretsOnFire-1.2.512-win32.zip
    ./frets_on_fire/full_game/FretsOnFire_ghc_mod.zip
    ./gametap_setup.exe
    ......
    lftp mirror.3fl.net.au:/games/misc> du gametap_setup.exe 
    32442   gametap_setup.exe
    lftp mirror.3fl.net.au:/games/misc> du -sh gametap_setup.exe 
    32M     gametap_setup.exe
    lftp mirror.3fl.net.au:/games/misc> 
    
    0 讨论(0)
  • 2021-02-02 11:41

    If you have ssh access, use rsync instead. It is a far better data transfer app.

    Grab fuse for your OS and load ftpfs. This will let you mount the remote ftp directory locally and you can use dir /s or any other application you want on it.

    0 讨论(0)
  • 2021-02-02 11:43

    Assuming you are using simple ftp via command line, Use dir command with -Rl option to search recursively and copy it to a file and then search the file using grep, find or whatever way is supported on your OS.

    ftp> dir -Rl education.txt output to local-file: education.txt? y 227 Entering Passive Mode (9,62,119,15,138,239) 150 Opening ASCII mode data connection for file list 226 Transfer complete

    0 讨论(0)
  • 2021-02-02 11:44

    Do this :

    ls -lR
    

    ..................

    0 讨论(0)
  • 2021-02-02 11:50

    You can use ftp.listFiles("directory") from apache-commons-net and can write your own BFS or DFS to fetch all the files recursively.

    0 讨论(0)
提交回复
热议问题