List all the directories on a given url on remote server

Could any body help me in Listing the files on a given URL directory on a remote server using Java.
I have done this:
File dir = new File("http://www.abc.com/web/data/sos/zip/tm/");
String[] children = dir.list();
if (children == null) {
out.println("CANNOT FIND ANY FILE");    // IT IS ALWAYS GOING IN THIS CONDITION AND FAILING THEREFORE.
// Either dir does not exist or is not a directory
} else {
for (int i=0; i<children.length; i++) {
// Get filename of file or directory
String filename = children;
out.println("HI");

kus wrote:
There is a solution but not a very portable one, i.e. you can't use it to get a listing of files from any server that you happen to look at. But here are the steps you need to take:
1. Use a browser (firefox, opera, etc.) to view the file listing and then view the source.
2. Duplicate the retrieval of data from the given URL in Java (new URL(...), etc.)
3. Parse the HTTP response and/or the HTML that the server returns to you to extract what you need.
Step #3 is the biggest piece of work and the format you need to parse will depend on whatever the remote server hands to you. It's intended for humans, not machines; every server can decide how to format this and it even depends on the server's configuration how this data is presented to you. In any case, it's entirely up to you to make sense of whatever the server happens to throw back at you and if the server happens to present you a nice, picturesque page rather than a listing of files then your completely out of luck.He actually wasn't talking about http at all, so most of this thread has been a wild goose chase.

Similar Messages

  • How can I use PowerShell 3.0 cmdlets or script to list all the local groups and local users of a server?

    Using PowerShell 3.0 (And if possible the CIM, not WMI cmdlet), how can I script with | out-file C:\<filename>.txt or .csv option to list all local user accounts & local groups
    on remote computers? 
    Thank You!

    I don't recall PowerShell V3 introducing anything new to handle local users and groups. You need to use PowerShell V1 methods, using the [ADSI] accelerator and the WinNT: provider. The scripts linked above show this. No need to use WMI (which would probably
    be slower).
    Here is a script I've used to enumerate all local groups and their members:
    $Computer
    = "MyServer"
    $Computer =
    [ADSI]"WinNT://$Computer"
    $Groups =
    $Computer.psbase.Children | Where {$_.psbase.schemaClassName
    -eq "group"}
    ForEach ($Group
    In $Groups)
        "Group: "
    + $Group.Name
        $Members
    = @($Group.psbase.Invoke("Members"))
        ForEach ($Member
    In $Members)
            $Class
    = $Member.GetType().InvokeMember("Class",
    'GetProperty', $Null,
    $Member, $Null)
            $Name
    = $Member.GetType().InvokeMember("Name",
    'GetProperty', $Null,
    $Member, $Null)
            "-- Member: $Name ($Class)"
    A similar script to enumerate all local users would be:
    $Computer
    = "MyServer"
    $Computer =
    [ADSI]"WinNT://$Computer"
    $Users =
    $Computer.psbase.Children | Where {$_.psbase.schemaClassName
    -eq "user"}
    ForEach ($User
    In $Users)
        "User: "
    + $User.Name
    Richard Mueller - MVP Directory Services

  • Cannot list all the servers within cluster (on Resin)

    We have 10 Resin servers in the cluster, but when I try to list them I got only 9 of them listed.
    It doesn't list the local server (the one from which the servlet is actually invoked).
    Do you have any other idea how to list all the servers?
    Here is the code I use:
    for (int i = 0; i < clusterList.length; i++) {
         ClusterMXBean cluster = (ClusterMXBean) Jmx.findGlobal(clusterList.getObjectName());
         // --- retrieve all servers within one cluster
         ServerConnectorMXBean[] srunNames = cluster.getServers();
         for (int j = 0; j < srunNames.length; j++) {
              ServerConnectorMXBean server = (ServerConnectorMXBean) Jmx
                        .findGlobal(srunNames[j].getObjectName());
              String host = server.getAddress();
              int port = server.getPort();
              String state = server.getState();
    And here is the MX configuration:
    resin:type=SessionManager,Host=default,WebApp=/
    resin:type=ServerConnector,name=i
    resin:type=ServerConnector,name=h
    resin:type=ServerConnector,name=b
    resin:type=Resin
    resin:type=ServerConnector,name=j
    resin:type=ProxyCache
    resin:type=Host,name=default
    resin:type=ServerConnector,name=c
    resin:type=ServerConnector,name=e
    resin:type=Port,name=192.68.1.50-6802
    resin:type=ServerConnector,name=g
    resin:type=ServerConnector,name=a
    resin:type=ThreadPool
    resin:type=WebApp,Host=default,name=/
    resin:type=WebApp,Host=default,name=/mya
    resin:type=ConnectionPool,Host=default,WebApp=/mya,name=jdbc/mya
    resin:type=ServerConnector,name=f
    resin:type=Cluster,name=cluster1
    resin:type=ServerConnector,name=d
    resin:type=SessionManager,Host=default,WebApp=/mya
    resin:type=Server                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    kus wrote:
    There is a solution but not a very portable one, i.e. you can't use it to get a listing of files from any server that you happen to look at. But here are the steps you need to take:
    1. Use a browser (firefox, opera, etc.) to view the file listing and then view the source.
    2. Duplicate the retrieval of data from the given URL in Java (new URL(...), etc.)
    3. Parse the HTTP response and/or the HTML that the server returns to you to extract what you need.
    Step #3 is the biggest piece of work and the format you need to parse will depend on whatever the remote server hands to you. It's intended for humans, not machines; every server can decide how to format this and it even depends on the server's configuration how this data is presented to you. In any case, it's entirely up to you to make sense of whatever the server happens to throw back at you and if the server happens to present you a nice, picturesque page rather than a listing of files then your completely out of luck.He actually wasn't talking about http at all, so most of this thread has been a wild goose chase.

  • Using ms project 2007 and vba macro to list all the custom fields used in the project?

    Hi,Using ms project 2007 vba macro, I would like to be able to list all the custom fields used in the project and their corresponding field names. e.g. let us say I create a calculated duration field and name it "expected duration" and the name
    of the field I select is Duration1.
    I am trying to write a macro that will list all the used custom fields such as the result would look like:
    Duration1 ---> "expected duration"
    Text1       ---> "anything"
    Flag1        ---> "....."
    Number1  ---> "..............."
    Can anyone provide me with the solution?
    Regards,
    Chuck

    John,
    I found this module, which provides the the list of custom fields used in the project but does not provide the name given to the field. Here below is the module and hope you could help me achieve this by modifying the macro to list the renamed field.
    ' MSP Checks all Custom Task Fields
    Sub checkfields2()
    'This macro will check and report out which custom task fields are used
    'It requires Project 2002 and above as it relies on the GetField
    'and FieldNameToFieldConstant methods which were not introduced until
    '2002.
    'It does not include resource fields, however it is a simple matter to
    'do it by replacing the pjTask constant with pjResource.
    'Copyright Jack Dahlgren, Oct. 2004
    Dim mycheck As Boolean
    Dim myType, usedfields As String
    Dim t As Task
    Dim ts As Tasks
    Dim i, it As Integer
    Set ts = ActiveProject.Tasks
    usedfields = "Custom Fields used in this file" & vbCrLf
    myType = "Text"
    usedfields = usedfields & vbCrLf & "--" & UCase(myType) & "--" & vbCrLf
    For i = 1 To 30
    mycheck = False
    it = 0
    While Not mycheck And (it < ts.Count)
    it = it + 1
    If Not ts(it) Is Nothing Then
    If ts(it).GetField(FieldNameToFieldConstant(myType & i, pjtask)) <> "" Then
    usedfields = usedfields & myType & CStr(i) & vbCr
    mycheck = True
    End If
    End If
    Wend
    Next i
    myType = "Number"
    usedfields = usedfields & vbCrLf & "--" & UCase(myType) & "--" & vbCrLf
    For i = 1 To 20
    mycheck = False
    it = 0
    While Not mycheck And (it < ts.Count)
    it = it + 1
    If Not ts(it) Is Nothing Then
    If ts(it).GetField(FieldNameToFieldConstant(myType & i, pjtask)) <> 0 Then
    usedfields = usedfields & myType & CStr(i) & vbCr
    mycheck = True
    End If
    End If
    Wend
    Next i
    myType = "Duration"
    usedfields = usedfields & vbCrLf & "--" & UCase(myType) & "--" & vbCrLf
    For i = 1 To 10
    mycheck = False
    it = 0
    While Not mycheck And (it < ts.Count)
    it = it + 1
    If Not ts(it) Is Nothing Then
    If Left(ts(it).GetField(FieldNameToFieldConstant(myType & i, pjtask)), 2) <> "0 " Then
    usedfields = usedfields & myType & CStr(i) & vbCr
    mycheck = True
    End If
    End If
    Wend
    Next i
    myType = "Cost"
    usedfields = usedfields & vbCrLf & "--" & UCase(myType) & "--" & vbCrLf
    For i = 1 To 10
    mycheck = False
    it = 0
    While Not mycheck And (it < ts.Count)
    it = it + 1
    If Not ts(it) Is Nothing Then
    If ts(it).GetField(FieldNameToFieldConstant(myType & i, pjtask)) <> 0 Then
    usedfields = usedfields & myType & CStr(i) & vbCr
    mycheck = True
    End If
    End If
    Wend
    Next i
    myType = "Start"
    usedfields = usedfields & vbCrLf & "--" & UCase(myType) & "--" & vbCrLf
    For i = 1 To 10
    mycheck = False
    it = 0
    While Not mycheck And (it < ts.Count)
    it = it + 1
    If Not ts(it) Is Nothing Then
    If ts(it).GetField(FieldNameToFieldConstant(myType & i, pjtask)) <> "NA" Then
    usedfields = usedfields & myType & CStr(i) & vbCr
    mycheck = True
    End If
    End If
    Wend
    Next i
    myType = "Finish"
    usedfields = usedfields & vbCrLf & "--" & UCase(myType) & "--" & vbCrLf
    For i = 1 To 10
    mycheck = False
    it = 0
    While Not mycheck And (it < ts.Count)
    it = it + 1
    If Not ts(it) Is Nothing Then
    If ts(it).GetField(FieldNameToFieldConstant(myType & i, pjtask)) <> "NA" Then
    usedfields = usedfields & myType & CStr(i) & vbCr
    mycheck = True
    End If
    End If
    Wend
    Next i
    MsgBox usedfields
    End Sub
    This is what the module gives me. But I would like to have beside Text 1 the name that is shown as below. e.g Text1 is "Test".
    Would you mind helping me achieve this?
    Thanks in advance.
    Chuck

  • How will get the source code of all the tables in a given schema using SQL?

    Hi All,
    How can we get the source code of all the tables in a given schema using SQL?
    Thanks in Adv.
    Junu

    Try something like...
    set heading off
    set pagesize 0
    col meta_data for a96 word_wrapped
    set long 100000
    SELECT DBMS_METADATA.GET_DDL(object_type, object_name, owner) ||';' AS meta_data
    FROM dba_objects
    WHERE owner = '<SCHEMA NAME>'
      AND object_type not in (<list of stuff you do not want>);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How can I list all the column names of a table by programming?

    Hi,
    Now I want to write an function which has the following features:
    Firstly, The function was given a parameter as table name.
    Then, it will lists all the columns names of the table.
    e.g
    table: person
    ---firstName------lastName----+
           Michale               Jackson
    We can get the columns 'firstname' and 'lastName' by calling the function with table name 'person'.
    And I also wonder that where I can get reference book or any other materials?
    Thanks.
    Edited by: wenjing wang on Feb 15, 2008 6:42 AM
    Edited by: wenjing wang on Feb 15, 2008 6:57 AM

    hi,
    hope the below code helps u. Just take the headee which contains the field name and split it like below and compare it with the field name u want here 'last name'.
    here,
    'First name' will be in wt_filedata1 and remaining field names in wt_filedata2, so 'do' continues.
    c_tab must be the separator, either , or + or tab etc..
    CODE:
    read table person into wl_header index 1.
    do.
        split wl_header at c_tab into: wt_filedata1 wt_filedata2.
        if wt_filedata1 <> 'lastname'.
          cnt1 = cnt1 + 1.
          wl_header = wt_filedata2.
        else.
          exit.
        endif.
      enddo.
    Please reward if it is useful.
    regards,
    sri

  • Listing all the Spotlight comments

    There was a wonderful widget called Tagbag! (http://www.apple.com/downloads/dashboard/business/tagbag.html) that listed all the words inside the "Spotlight comments" field, but it doesn't works anymore in Leopard. Also, the developer doesn't updates it for 3 year now, and I doubt he will. I tried Tagbot, but the "import tags" kills the app in Leopard.
    So, is there any other way to create a list of tags from the "Spotlight comments" field that exists in all my files?

    You should never make use of sun.* packages directly, see:
    http://java.sun.com/products/jdk/faq/faq-sun-packages.html
    To get a list (NLST command) then open a URL connection to ftp://user:[email protected]/dir/motd;type=d as per section 3.2.2 of RFC 1738. Alternatively use a third-party ftp client (there are many).

  • Listing all the populated variables when a swf is loaded from an embed tag ?

    Hello,
    well, everything is in the title, I've been wondering how I
    could possibily do this for some time now.
    and all I tried or thought of went nowhere.
    I'd like to list all the variables an html embed tag passes
    on to the swf file called, whatever they are named and how many
    there is.
    <EMBED
    src="example.swf?var="varcontent",var2="var2content">
    it's not life-threatening, but I hate using things that work
    when I have an idea for things that would work better x)

    thanks, I didn't think it would be this simple to list all
    var in _root.
    the only issue remaining is the case where I have more than
    one url passed on to my swf file, and how to distinguish which one
    is the one to use, but that's not really feasible (and anyway I
    can't think of a case where more than one var would be passed to
    the swfs I work on, let alone populated with an url).

  • How to print/list all the groups/users present in Weblogic using Java code

    Hi,
    Weblogic version : 11.1.1.5
    How to print/list all the groups/users present in Weblogic using Java code
    I want to make a remote connection to Weblogic server and print all the users/groups present in it.
    I have gone through the below mentioned site, but I cannot use the same approach since most of the API' are deprecated for example "weblogic.management.MBeanHome;"
    http://weblogic-wonders.com/weblogic/2010/11/10/list-users-and-groups-in-weblogic-using-jmx/
    Thanks in advance,
    Edited by: 984107 on 05-Feb-2013 05:26
    Edited by: 984107 on 05-Feb-2013 22:59

    see this http://www.techpaste.com/2012/06/managing-user-groups-wlst-scripts-weblogic/
    Hope this helps.

  • How can I list all the domains configured for Weblogic Servers?

    How can I list all the domains configured for Weblogic Servers?
    I saw a note, which says the following:
    "WebLogic Server does not support multi-domain interaction using either the Administration Console, the weblogic.Admin utility, or WebLogic Ant tasks. This restriction does not, however, explicitly preclude a user written Java application from accessing multiple domains simultaneously."
    In my case, I just want to list all the domains, is that possible by using any scripts?
    Thanks
    AJ

    If you use WLS Node Manager and the Config Wizard was used to create the domains, then the list of domains should be in a location like this:
    <MIDDLEWARE_HOME>\wlserver_10.3\common\nodemanager\nodemanager.domains
    Enterprise Manager Grid Control also has support for multi-domain management of WLS in a console.

  • How to identify all the information for a given company code?

    Hi,
    Our company provides data migration services for SAP and other ERP applications. Our customers provide us the specifications for extractions and conversions. We use one or more 3rd party tools to extract data from legacy systems into text/Excel files. Customers use LSMW to load generated files.
    We just got an unusual request. This customer wants to get ALL the data from SAP for a given company code and dump into Excel. They would do some manual editing on the data and load it into a new SAP client.
    In the past, customers would be more specific in their requirements. For example, they will mention Materials, Customers, Inventory, etc. In this case, the customer simply wants ALL the data for a given company code.
    Q1. Is everything in SAP related to company code, either directly or indirectly? For example, can materials be filtered by company code?
    Q2. The tools that we use let us extract data from SAP using SQL-like queries. How do I identify ALL the tables that I would need for a given company code?
    My feeling is the customer themselves are not clear on what they really want. Perhaps they are expecting us to guide them.
    I would appreciate any thoughts that you may have.
    If there is a more appropriate forum for this question, please let me know.
    Thank you in advance for your help.
    Regards,
    Peter

    hi
    t001w is the master table for plants, u can see all plants in this table.
    regads:
    rajesh.k

  • When i go to the app store to update the one app that needs to be updated, the screen is blank.  It used to list all the apps that need updating and have a button called update all.  Now nothing.  Just a blank screen.

    when i go to the app store to update the one app that needs to be updated, the screen is blank.  It used to list all the apps that need updating and have a button called update all.  Now nothing.  Just a blank screen.  How can I fix this?

    There's been a problem with this all day.  Seems to be a server problem  -  wait a day and try again, or use itunes on the computer to update, that works.

  • Is there a way of listing all the current keyboard shortcuts?

    Within a program is there a way of listing all the current keyboard shortcuts , in a sensible order?
    I mean in shortcut order,  giving the name of the menu option (or other function) alongside.
    I often want this when I"m about to define my own keyboard shortcut, to see what's already taken.

    dominic23 wrote:
    https://discussions.apple.com/message/21487716#21487716
    Hope this helps.
    Not sure it does help. In http://support.apple.com/kb/PH10837 it says
    If you assign a keyboard shortcut that already exists for another command or another app, your new shortcut won’t work. Find the menu command that’s using it and reassign the keyboard shortcut for that item.
    I looking for a quick way to "find the menu command" - or even better, to avoid choosing one that's already being used.

  • How to list all the datatypes are being used in the database?

    Is there any way you can list all the oracle datatypes are being used in the database?
    Thanks,
    Chau

    Use USER_TAB_COLUMNS or DBA_TAB_COLUMNS to determing various data type but USER_TAB_COLUMNS will show you what type being used by a schema user

  • How to list all the rows from the table VBAK

    Friends ,
    How to list all the rows from the table VBAK.select query and the output list is appreciated.

    Hi,
    IF you want to select all the rows for VBAK-
    Write-
    Data:itab type table of VBAK,
           wa like line of itab.
    SELECT * FROM VBAK into table itab.
    Itab is the internal table with type VBAK.
    Loop at itab into wa.
    Write: wa-field1,
    endloop.

Maybe you are looking for

  • MacBook Pro spontaneously wakes from sleep after upgrading to Leopard?

    For some reason, after I upgraded to Leopard, then whenever I put my MacBook Pro to sleep, it spontaneously wakes up after some time (can be from a few minutes to an hour or two.) I don't know why this is happening, but I know for sure that it's rela

  • Printing SFP ADOBE generated pdf from spool.

    I am trying to print ADOBE PDF file to HP Designjet Z5400 plotter.  It successfully writes a pdf file to the spool.  When I either release that spool file to print or have the print job set to print immediately I get a spool error - unable to read fo

  • Rolling month for webi report using Univ based on BEX Query

    Dear Experts, I'm new to OLAP universes. We have a requirements of having last 12 months rolling  for given measure(Key figure) in webi report using Univ based on Bex Query. We require a calmonth (time dimension) object  (restricted for last 12 month

  • BI Publisher -Schedules Tab not active

    Hi Experts, I have configured the scheduler as given in "http://oraclebizint.wordpress.com/2007/09/13/oracle-bi-ee-10133-configuring-delivers-ibots/". I am able to start the services [Server , Presentation and also the Scheduler]... But when i login

  • Adobe CS6 Media Encoder encoding 4K video

    When will Adobe CS6 media encoder be upgraded to process 4K video or encode into h.265?