Files list of a FTP directory

Hi can any one help out regarding listing of a directories of a ftp location
i used org.apache.commons.net.ftp
i tried in following way
FTPClient client = new FTPClient();
try {                
client.connect("192.168.100.189");
     client.login("XXXX", "XX");
     int reply=client.getReplyCode();
     System.out.println(reply); //i can able to connect to the ftp location with reply code 230.
     FTPFile[] files=client.getFiles();//here it displaying the exception
     System.out.println(files.length);
catch(Exception e)
System.out.println(e);
Please help out
Regards
Praveen

Thanks for your reply
java.lang.NoClassDefFoundError: org/apache/oro/text/regex/MalformedPatternException
     at org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory.createNTFTPEntryParser(DefaultFTPFileEntryParserFactory.java:184)
     at org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory.createFileEntryParser(DefaultFTPFileEntryParserFactory.java:102)
     at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2358)
     at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2141)
     at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2188)
     at FTPTest.main(FTPTest.java:29)
Regards
Praveen

Similar Messages

  • How can I get file list for a given directory?

    Hi,
    How can I get file list for a given directory? Is there a function?
    Thanks.

    Hi friend,
    Try this sample report. It displays all files in a directory.
    While executing give some directory name in input. ex:  C:\
    Mention file type in filter parameter. ex: *.DOC
    REPORT ztests.
    DATA : file_table LIKE TABLE OF sdokpath WITH HEADER LINE .
    DATA : dir_table LIKE TABLE OF sdokpath WITH HEADER LINE .
    PARAMETERS:p_dir(50) TYPE c.
    CALL FUNCTION 'TMP_GUI_DIRECTORY_LIST_FILES'
      EXPORTING
        directory  = p_dir
        filter     = '*.DOC'
      TABLES
        file_table = file_table
        dir_table  = dir_table
      EXCEPTIONS
        cntl_error = 1
        OTHERS     = 2.
    LOOP AT file_table .
      WRITE:/ file_table-pathname.
    ENDLOOP.
    Might be helpful...
    Thanks.....
    Edited by: Guest77 on Feb 11, 2009 5:30 AM

  • Get the file list of a given directory

    does anyone know how to get the file list of a given directory? I tried "list"/"filelist" but the class not found.
    THanks!

    What made you assume that there exist classes called list or filelist etc.
    Do you read API documentation etc ?
    Anyways, here is a hint java.io.File.listFiles()

  • Get file list from URL/web directory

    Hey guys,
    I have created a script for After Effects that can download multiple images from URLs that are given in an array. Now ideally what I want, is to get all the filenames of the files in a certain browsable web directory to be put in an array.
    Unfortunately, I can't seem to figure out how to do this. Does someone have the knowledge here to help me out?
    Thanks in advance,
    Jorge

    This is more difficult to do than it seems. Since the files are on a remote web server, you need to find some way to get the server to divulge its local file structure, which is not something most servers will do. The absolute best way is to have control over the web server and run some server-side code (PHP, node.js, whatever) to generate the file list on the server side and then fetch it with your client/extension/script. Other than that it's almost impossible to get a 3rd party server to divulge its file structure as far as I know, mainly for security reasons. So the #1 question is: do you have control over the server/website that you're trying to fetch from or not?

  • FM to GET file listing of a UNIX directory.

    Hello everyone,
    Please can anyone provide me a function module that can return to me ALL the files found inside a UNIX directory. I have tried FM EPS_GET_DIRECTORY_LISTING but I can't seem to provide the correct parameter.

    Ryan,
    check this program,
    REPORT ZFTPSAP LINE-SIZE 132.
    DATA: BEGIN OF MTAB_DATA OCCURS 0,
    LINE(132) TYPE C,
    END OF MTAB_DATA.
    DATA: MC_PASSWORD(20) TYPE C,
    MI_KEY TYPE I VALUE 26101957,
    MI_PWD_LEN TYPE I,
    MI_HANDLE TYPE I.
    START-OF-SELECTION.
    *-- Your SAP-UNIX FTP password (case sensitive)
    MC_PASSWORD = 'password'.
    DESCRIBE FIELD MC_PASSWORD LENGTH MI_PWD_LEN.
    *-- FTP_CONNECT requires an encrypted password to work
    CALL 'AB_RFC_X_SCRAMBLE_STRING'
         ID 'SOURCE' FIELD MC_PASSWORD ID 'KEY' FIELD MI_KEY
         ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD MC_PASSWORD
         ID 'DSTLEN' FIELD MI_PWD_LEN.
    CALL FUNCTION 'FTP_CONNECT'
         EXPORTING
    *-- Your SAP-UNIX FTP user name (case sensitive)
           USER            = 'userid'
           PASSWORD        = MC_PASSWORD
    *-- Your SAP-UNIX server host name (case sensitive)
           HOST            = 'unix-host'
           RFC_DESTINATION = 'SAPFTP'
         IMPORTING
           HANDLE          = MI_HANDLE
         EXCEPTIONS
           NOT_CONNECTED   = 1
           OTHERS          = 2.
    CHECK SY-SUBRC = 0.
    CALL FUNCTION 'FTP_COMMAND'
         EXPORTING
           HANDLE = MI_HANDLE
           COMMAND = 'dir'
         TABLES
           DATA = MTAB_DATA
         EXCEPTIONS
           TCPIP_ERROR = 1
           COMMAND_ERROR = 2
           DATA_ERROR = 3
           OTHERS = 4.
    IF SY-SUBRC = 0.
      LOOP AT MTAB_DATA.
        WRITE: / MTAB_DATA.
      ENDLOOP.
    ELSE.
    do some error checking.
      WRITE: / 'Error in FTP Command'.
    ENDIF.
    CALL FUNCTION 'FTP_DISCONNECT'
         EXPORTING
           HANDLE = MI_HANDLE
         EXCEPTIONS
           OTHERS = 1.  
    DATA:
    l_pcfile LIKE sapb-sappfad, "Desktop file & path
    l_serfil LIKE sapb-sappfad. "Server File & path
    l_pcfile = 'D:\Data\temp\input.txt'.
    l_serfil = '/tmp/output.txt' .
    CALL FUNCTION 'ARCHIVFILE_CLIENT_TO_SERVER'
    EXPORTING
    path = l_pcfile
    targetpath = l_serfil
    EXCEPTIONS
    error_file = 1
    OTHERS = 2.
    Don't forget to reward if useful.....

  • Integration of BIP Report file bursting with Unix FTP directory(using IBot)

    We have a requirement for dynamically creating the folder in FTP server, which gets the bursted file when a BIP report is executed.
    We have used the following approach:
    Created a IBot with Custom Java Program which creates a folder dynamically in FTP, now we are facing the problem to integrate this IBot with the BIP report file bursting.
    Can anyone suggest how to overcome this issue or is there any alternative approach to achieve the above requirement.
    Any help would be appreciated.

    .

  • Web Matrix FTP Remote Connection Error - "Connection Error - Failure to get file list from server. An entry with the same key already exists."

    Does anyone have experience with this issue when connecting to a Linux FTP Web Server running a FTP Site?
    "Connection Error - Failure to get file list from server. An entry with the same key already exists."
    I cannot access the root directory of the ftp file server using Web Matrix 3. The site is .php based, and
    is accessible when connecting with FileZilla or Remote Connecting via FTP with Visual Studio.
    All sites have been deleted from Web Matrix, the user Application Data has been cleared and Web Matrix has been reinstalled.
    Issue Persists....
    Thanks in advance,
    Justin

    Turns out that the program leaves metadata in your app data folder that is not removed upon uninstallation of the software.
    This is incorporated to communicate with a file that uploaded into the ftp directory when publishing pages.

  • FTP Get File List Action Block, It's double listing files!  ver 11.5

    Hi guys.. I have a good one!   I have an FTP Get File List action block in my BLS transaction.  Occasionally, it double lists the files in its output.   For testing I put a repeater with a logevent output where I log the filename, date, and size.  Heres what I saw for my action block output.
    2009-02-13 00:38:00,963  [UserEvent] : File Name: DMM_Export_0010056.txt, File Date 2009-02-13T00:36:00, File Size 339
    2009-02-13 00:38:00,963  [UserEvent] : File Name: DMM_Export_0010056.txt, File Date 2009-02-13T00:36:00, File Size 339
    This is xMII  version 11.5.6 b73  with java 1.4.2_07
    I have a workaround by putting in a distinct action block, after the filelist, but anybody have an idea why this might happen?   My theory is that something might be occuring if the file is being written to while we try to process it, but not sure. 
    I've been building BLS parsers since 2003, (Remember those fun times with Jeremy?)   I've never seen this happen.

    My example is a sample log file before the distinct action.  The general log shows nothing other than the subsequent transaction errors I get as a result of running the same error twice (Tcode return from BAPI calls etc)
    Here is something else interesting..  my userlog file is acting funny, like its trying to write on top of itself.  could it be the transaction is actually running twice or parts of it? 
    For example look at the following log entries
    This is how my log file entry for a production confirmation should look
    2009-02-13 00:38:06,854 [LHScheduler-Int10_NestingWOProdConf] INFO   UserLog - [UserEvent] :
    However sometimes... its looking like this...
    2009-02-13 2009-02-13 00:38:11,854 [LHScheduler-Int10_NestingWOProdConf] INFO   UserLog - [UserEvent] :
    Like it started writing to the log, then started again.
    The problem we are having is that we have JCO calls to SAP in this transaction that does goods movement, we get locking / block errors back from our  saying that we (our sap account) is already updating the information.   Sometimes the information would be posted twice!  You can see how this has become a HUGE issue posting data to a LIVE system twice.
    This is happening on 2 xMII servers.

  • Get file list in a directory

    Hi,
    How can i get the files liste in a directory from forms ? I want to know all the files in c:\my_dir\
    Thanx
    Herome

    Thanks but my form must run on different environement and dir will not return the same output to my_file.txt ! Is there any other "cleaner" way to do the job ?
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Dino ([email protected]):
    U can use Host command. I.e.
    Host ('dir c:\my_dir > my_file.txt');
    and then u can read this ascii file.
    Hope this helps.
    Bye Dino<HR></BLOCKQUOTE>
    null

  • Get file list of directory files from URL ?

    Hello,
    GIven a URL directory, I would like to get a list of all the files in that URL directory:
    url = new URL("http//www.example.com");
    c = url.getContent();
    // Suppose there is a file http://www.example.com/myfile.txt
    // How do I get a list from c?
    Essentially, I want something equivalent to the File "list" method
    file = new File("H:/tmp");
    list = file.list()
    Thanks in advanced.

    Crosspost: http://forum.java.sun.com/thread.jsp?thread=518669&forum=17&message=2475782

  • Automatic import of material data (csv file) from FTP directory

    Hello Experts,
    We created a Scheduled Task -> Data Import Monitor -> from a FTP directory.
    We loaded the .csv file with material data in the FTP folder but it is not getting imported.We have created the .csv file with the format of fields defined in Company quick start Work book -> Material tab. We also tried with a .csv file having first Field as CLASS_NAME with a value of masterdata.Material and rest of the fields same as defined in the Company quick start-Materials Tab still it did not work.
    When we load the .xls work book in FTP directory (xl having the Configuration tab and Material tab) the data import is working fine and the data is getting loaded automatically from the data import monitor job.
    Is there any specific format of .csv file in which the material data needs to be loaded to the FTP server for automatic import of data using Scheduled task?
    Regards
    Aditya

    Are there any errors appearing in the FPA logs?
    Have you checked the permissions on the folder/file that you are uploading from?
    What type of scheduled task have you created?

  • FTP Adapter not writing the file in FTP directory

    We have desiged BPEL Process which will get data from Oracle and write in txt file in FTP directory.
    For last few days, we are getting following error when we invoke the BPEL Process:
    file:/u102/product/10.1.3.1/OracleAS_1/bpel/domains/default/tmp/.bpel_XXADS_INT033_DEL_EBS_OUT_1.0_0be42a99260084d9bd5104929a8ac1b2.tmp/DELFTPservice.
    wsdl [ Put_ptt::Put(opaque) ] - WSIF JCA Execute of operation 'Put' failed due
    to: Error saving control file.
    Error saving control file: "/u102/product/10.1.3.1/OracleAS_1/j2ee/home/fileftp/controlFiles/ZmbNdvlpVkaee+
    OddQzH2Q==/outbound/controlFile_ob.properties"
    ; nested exception is:
    ORABPEL-11080
    Error saving control file.
    Error saving control file: "/u102/product/10.1.3.1/OracleAS_1/j2ee/home/fileftp/controlFiles/ZmbNdvlpVkaee+
    OddQzH2Q==/outbound/controlFile_ob.properties"
    Please make sure that a valid control file exists.
    Can anyone help me to resolve this?
    Thanks,
    Hariharan Ramakrishnan

    I tried to redo the config objects but still the same issue is there. anyone has any idea

  • How to list the top 10 largest files in the current working directory ?

    How can I list the top 10 largest files in the current working directory in Solaris ?

    execute below....to get the large files in order.. change the <FS>
    find /<FS> -type f -size +1024 -ls | awk '{print $11, $7}' | sort -rn +1 | awk '{print $1, $2/1024/1024 "MB"}' | /bin/more

  • FTP_COMMAND in order to get files list at FTP address

    Hi all.
    I want to get a list of files exist at a specific FTP address.
    For that I'm using FTP_CONNECT (OK) and after I want to execute FTP_COMMAND with parameter command = 'ls' in order to recievce the files list in output table data[].
    I keep on getting an exception 3 (data_error).
    Anyone can help please ?
    Thanks,
    Rebeka

    Hello,
    I know by experience the ABAP programmers learn most based on examples.
    In every SAP system you have the following FTP example programs, analyze the source code and check how function modules like FTP_CONNECT and FTP_COMMAND work :
    RSFTP002                         Execute FTP Command
    RSFTP003                         FTP put / get Test
    RSFTP004                         FTP Copy
    RSFTP007                         Test FB:FTP_SERVER_TO_R3 / FTP_R3_TO_SERVER
    RSFTP008                         Test FB:FTP_CLIENT_TO_R3 / FTP_R3_TO_CLIENT
    RSFTP009                         Test FTP put with Verify
    RSFTP011                         FTP Copy
    Success.
    Wim

  • Issue while fetching the file through *.extension by FTP sender file adapte

    Hello Experts,
    I am facing a issue while fetching the data through sender File adapter with  ' *.file extension' .I am illustarting the scenario as below .
    It is a simple scenarion of File to File inboumd scenarion.Here file is getting picked up from a third party system
    through FTP sender chanel and stored in a temp folder of PI through NFS rceiver file adapter .
        The problem is however I am getting, while picking the file with file name as "*.exo"(where exo is the file extension).
    But while fetching the file with particular name like"abcd_10032011*.exo"(file naming has been done by combination of abcd(always same)_currentdate(change according to current date)),file picked successfully .
    So here ,in the prior case file not getting picked up,but in later case it dose .
    Can anyone please let me know what might be the issue?

    Hi Sunit,
    Connect from your PI System to 3rd Party System (where are placed the Source Files)
    FTP <PartySystemHostName>
    eg. FTP 10.2.3.456 (then insert Username & Password to Login)
    Go to source directory
    cd \<SourceDirectory>
    eg. cd \donaldduck\directory\
    Execute a File List command
    ls -la *.<extension>
    eg. ls -la *.exo
    In this way you should be able to view all files with this extension (*.exo), the same action that Sap XI perform to pickup the file.
    Then, try to copy that file to your Local PI System (to check if there're some permissions issue):
    mget <filename>.exo
    eg. mpget File1_01012011.exo

Maybe you are looking for

  • How to replace all prior admin account info and files

    I know this is a common question but I'm bogging down reading the various threads and would appreciate a link or answer. I replaced my Powerbook hard drive, clean installed (no archive) and updated Tiger, transfered my home folder and apps only via C

  • ITunes folder not found

    I recently upgraded to the latest version of iTunes (6.0.5.20) ever since then, I try to open iTunes and all I get is the following error...."The Folder "iTunes" can not be found or created, and is required. The Default location for this folder is in

  • OBIEE Report - Urgent Help!!!! (May be Self Join - Then How)

    Hi, We have an urgent situation here and trouble finding the solution in correct way. Below is the explanation....Hope it would not be so complicated.... I have 3 tables - 2 dimension (Product, Customer), 1 Fact (Dollars) as below - I want to have a

  • Roles and transaction authorizations for XI developer

    Hi All, Can anyone validates my requirements to Basis gui in SAP-XI installation. Transactions authorizations needed are: SXMB_IFR SXMB_MONI SXMB_MONI_BPE SXI_Monitor SXI_Cache IDX1 IDX2 ALERTCATDEF SM59 WE21 WE20 Do we require any other transactions

  • Firewall ports for appv client

    native Appv infrastructure. Apps are published using UNC. what ports should be open for the clients sitting behind the firewall? --- When you hit a wrong note its the next note that makes it good or bad. --- Miles Davis