Directory Listing in a JSP

Hello, I try to list a directory in a JSP file, but I get this when I try it: "[Ljava.lang.String;@8e4805"
My code is:
<% 
String userPath=request.getRealPath("users/");
File f = new File(userPath);
String[] files = f.list();
for(int i=0; i<files.length; i++) {
out.println(files);
%>

Hello, I try to list a directory in a JSP file, but I
get this when I try it: "[Ljava.lang.String;@8e4805"
My code is:
<%
String userPath=request.getRealPath("users/");
File f = new File(userPath);
String[] files = f.list();
for(int i=0; i<files.length; i++) {
out.println(files);
%>
That's cause out.println(files) will call the toString method of the String[], not the particular index you want to print. Try:
<%
  String userPath=request.getRealPath("users/");
  File f = new File(userPath);
  String[] files = f.list();
  for(int f=0; f<files.length; f++) {
    out.println(files[f]);
%>

Similar Messages

  • Directory Listing

    Hi All,
    I want to beable to display a directory listing in a JSP page, like filename and if possible size and creation date.
    I found this example :
    http://forum.java.sun.com/thread.jspa?forumID=45&threadID=271208
    But it doesn't do much. This example show how many files it's found but
    doesn't show them.
    Any other examples?
    Thanks!

    All you need is the File class. Check out the api docs (java.io.File), and more specifically the listFiles() method.

  • Directory listing for a directory within the webapplication

    Hi,
    I have a the code which does the directory listing of a given directory using its absolute path. eg new File("c:/webapp/tempdir");).
    I want to do the directory listing by giving a path relative to the context path of the webapp like(new File("/temp");)
    When I try to do
    <%
    File f1=new File("/tempDir");
    f1.exists(); --> returns flase
    %>
    tempDir is a directory in my webapplication. How should I reference this? Should I have to use file:// or http://?
    Looking forward for your help
    Thanks in advance

    There is a method in ServletContext: getRealPath.
    http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletContext.html
    It turns a website relative path into a real location on disk.
    // only need this line in a servlet.  "application" is already defined in a jsp
    ServletContext application = getServletConfig().getServletContext();
    String filePath = application.getRealPath("/tempDir");
    File f1 = new File(filePath);Some issues with using this approach:
    If your application is in an unexploded WAR file, then getRealPath() can return null, as there isn't really a location on disk that it relates to.

  • CME Directory list

    Hi all, I'm racking my brain with this one.
    I typed http://192.168.10.252/localdirectory into a web browser and was hoping to get an xml view of my CME phone directory instead I get an XML browser error:
    “The XML page cannot be displayed
    Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
    XML document must have a top level element. Error processing resource 'http://192.168.10.252/localdirectory'
    “
    I'm trying to publish the directory on the intranet (using ASP) but so far I have had no luck getting the directory list. I have tried using the XML Api but all I can get is a list of extension numbers with no names using:
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/1999/XMLSchema">
    <SOAP-ENV:Body>
    <axl xsi:type="request"
    xmlns="http://www.cisco.com/AXL/1.0"
    xsi:schemaLocation="http://www.cisco.com/AXL/1.0
    http://gkar.cisco.com/schema/axlsoap.xsd">
    <request xsi:type="ISgetExtension">
    <ISgetExtension>
    <ISExtNumber>all</ISExtNumber>
    </ISgetExtension>
    </request>
    </axl>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    Any help on this would be greatly appreciated.
    Thanks,
    Craig.

    Hmm
    try this:
    http://yourCM-IP:8080/ccmcip/xmldirectorylist.jsp
    (never rely on DNS when dealing with IP telephony) it will return an xml parse error (as happened with you) but again when you view the page source you will see the XML directory list.
    P.S: this is for a list on IP phones added on call manager 6 , you van use the directories URL on the Phone's config page.

  • How to avoid directory listing in java web applications.

    how to avoid directory listing in java web applications.
    That is on typing the url of the application it should not the directory listing. Welcome tag in web.xml doesnot fully solve the problem, since still the images folder etc is still accessible

    I know of two ways.
    If you're using tomcat and have access to the conf directory.
    Edit your $TOMCAT/conf/web.xml. Find your default servlet properties and change
      <servlet>
        <servlet-name>default</servlet-name>
        <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
        <init-param>
          <param-name>debug</param-name>
          <param-value>0</param-value>
        </init-param>
        <init-param>
          <param-name>listings</param-name>
          <param-value>true</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
      </servlet>to  <servlet>
        <servlet-name>default</servlet-name>
        <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
        <init-param>
          <param-name>debug</param-name>
          <param-value>0</param-value>
        </init-param>
        <init-param>
          <param-name>listings</param-name>
          <param-value>false</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
      </servlet>And restart your server. This will affect every directory on the server, and return a 405 directory browsing forbidden error.
    Another way, is to place an index.jsp inside each directory with a simple one line redirect to your applications CONTEXT_PATH.response.sendRedirect("http://yourserver/yourapp/");This will only affect specific directories which contain these index.jsp files.
    Hope this helps

  • Overriding Tomcat's directory listing

    I made my own directory listing JSP which includes thumbnails of pictures. Right now I have to copy the file, index.jsp, into every directory to make it the directory listing. How can I stop this?

    It doesn't seem to be working, but I suspect it is a newbie error on my part. Here' s my server.xml (I tried it as shown below, in my apps-project.xml file, and outside the <server> key:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <Server>
        <!-- You can add a "home" attribute to represent the "base" for
             all relative paths. If none is set, the TOMCAT_HOME property
             will be used, and if not set "." will be used.
             webapps/, work/ and log/ will be relative to this ( unless
             set explicitely to absolute paths ).
          -->
        <ContextManager workDir="work" >
    <StaticInterceptor listing="false" />
          <!-- ==================== Global modules ==================== -->
            <LoaderInterceptor11  useApplicationLoader="true" />
            <TrustedLoader />
            <LogSetter name="tc_log" timestamps="true"
                 verbosityLevel="INFORMATION"  />
            <LogEvents enabled="false" />
            <!-- Backward compat: read the Context declarations from server.xml-->
            <ContextXmlReader config="conf/server.xml" />
            <!-- Separated Context -->
            <ContextXmlReader config="conf/apps.xml" />
            <AutoDeploy source="modules" target="modules"
                  redeploy="true" />
            <AutoWebApp dir="modules" host="DEFAULT" trusted="true"/>
            <AutoDeploy source="webapps" target="webapps" />
            <AutoWebApp dir="webapps" host="DEFAULT" />
            <PolicyLoader securityManagerClass="java.lang.SecurityManager"
                    policyFile="conf/tomcat.policy" />
            <SimpleMapper1 />
            <SessionExpirer checkInterval="60" />
            <!-- For development you can use randomClass="java.util.Random" -->
            <SessionIdGenerator randomClass="java.security.SecureRandom"
                                randomFile="/dev/urandom" />
            <!-- ========== context processing modules ========== -->
            <!-- This will be the "default" profile
                 ( all except the "global" modules can be set per context )
              -->
            <LogSetter name="servlet_log"
                 timestamps="true"
                 verbosityLevel = "INFORMATION"
                 path="logs/servlet-${yyyyMMdd}.log"
                 />
            <LogSetter  name="JASPER_LOG"
                 timestamps="true"
                 path="logs/jasper-${yyyyMMdd}.log"
                 verbosityLevel = "INFORMATION"  />
            <WebXmlReader validate="true" />
            <ErrorHandler showDebugInfo="true" />
            <WorkDirSetup cleanWorkDir="false" />
            <Jdk12Interceptor />
            <!-- Non-standard invoker, for backward compat. ( /servlet/* ) -->
            <InvokerInterceptor />
            <!-- you can add javaCompiler="jikes" -->
            <JspInterceptor keepGenerated="true"
                   largeFile="false"
                   useJspServlet="false"
                   />
            <StaticInterceptor listings="true" />
            <ReloadInterceptor fullReload="true" />
            <SimpleSessionStore maxActiveSessions="-1" />
            <AccessInterceptor />
            <CredentialsInterceptor />
            <SimpleRealm  filename="conf/users/global-users.xml" />
           <!-- UnComment the following and comment out the
                above to get a JDBC realm.
                Other options for driverName:
                  driverName="oracle.jdbc.driver.OracleDriver"
                  connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
                  connectionName="scott"
                  connectionPassword="tiger"
                  driverName="org.gjt.mm.mysql.Driver"
                  connectionURL="jdbc:mysql://localhost/authority"
                  connectionName="test"
                  connectionPassword="test"
                "connectionName" and "connectionPassword" are optional.
            -->
            <!--
            <JDBCRealm
                debug="99"
             driverName="sun.jdbc.odbc.JdbcOdbcDriver"
             connectionURL="jdbc:odbc:TOMCAT"
             userTable="users"
                userNameCol="user_name"
                userCredCol="user_pass"
             userRoleTable="user_roles"
                roleNameCol="role_name" />
            -->
            <LoadOnStartupInterceptor />
            <Servlet22Interceptor />
            <!-- Tag pooling support.
                 To enable the reuse of tag handlers as described in
                 the JSP spec, uncomment the following.  If your pages
                 use a lot of custom tags, you should see a nice performance
                 gain.
                 Note that placing the interceptor here will enable
                 Tag pooling for all of the web applicatitions loaded -
                 this may be a bad thing if all tags are not coded to
                 handle reuse. To enable pooling only for specific web
                 applications i.e. Contexts, place the interceptor inside of
                 the Context's definition.
                 To view information about tag usage uncomment the tag
                 LogSetter. Set verbosityLevel to DEBUG to see everytime
                 a tag is obtained and released.
            -->
            <!--
            <LogSetter  name="tag_pool_log" timestamps="true"
                path="logs/tagpool-${yyyyMMdd}.log"
                verbosityLevel="INFORMATION" />
            <TagPoolManagerInterceptor />
            -->
            <!-- Request processing -->
            <DecodeInterceptor />
            <SessionId cookiesFirst="true" noCookies="false" />
            <!-- Automatic config generation
                 Set noRoot="false" if you wish to have Tomcat try to take
                   control of the external web server's root context.
                   Additonal configuration of the external web server may be
                   required for this to be successful.
                 Note: Configuration files are not written as part of the
                   default startup behvior.  Append "jkconf" to the startup
                   command to have Tomcat initialize, write the config files,
                   then exit. This may be done while Tomcat is running.
              -->
            <ApacheConfig noRoot="true" />
            <IISConfig noRoot="true" />
            <NSConfig noRoot="true" />
             <!-- Uncoment for apache-style logs
                  Attributes: logFile, flush, format
            <AccessLogInterceptor/>
              -->
          <!-- ==================== Connectors ==================== -->
           <!-- new http adapter. Attributes:
                   secure - use SSL ( https )
                   keystore, keypass - certs for SSL
                   port
                   reportedname - Server name to send back to browser
                                  by default report Tomcat Web Server ...
                                  set an empty string to avoid sending server header
            -->
            <Http10Connector   port="8080"
                      secure="false"
                      maxThreads="100"
                      maxSpareThreads="50"
                      minSpareThreads="10" />
            <!--
                Uncomment this for SSL support. You _need_ to set up a
                server certificate if you want this to work, and you
                need JSSE. See tomcat-ssl-howto.html for more detailed
                instructions.
                1. Make the JSSE jars available to Tomcat, either by making
                   them an installed extension or by adding them to the
                   Tomcat CLASSPATH.
                2. Do: keytool -genkey -alias tomcat -keyalg RSA
                   RSA is essential to work with Netscape and IIS.
                   Use "changeit" as password. ( or add keypass attribute )
                   You don't need to sign the certificate.
             -->
            <!--
            <Http10Connector  port="8443" secure="true" />
            -->
            <!--
                 JNI connector. It assumes the library is located in
                 TOMCAT_HOME/bin/native/jni_connect.[dll, nlm, so]. or in LD_LIBRARY_PATH.
                 For different paths set "nativeLibrary" parameter.
                 The JniConnector will be self-enable only if JNI mode is detected.
             -->
            <JniConnector />
            <!-- Apache AJP12 support. This is also used to shut down tomcat.
                 Parameter "address" defines network interface this Interceptor
                 "binds" to. Add it if you want to "bind" to just "127.0.0.1".
                 address="127.0.0.1"
                 Parameter "tomcatAuthentication", controls if Tomcat honors
                 ( and uses ) auth done in HTTP Server or not, when true Tomcat does
                 not use in any way auth information provided by the HTTP Server.
                 true is the default.
                 tomcatAuthentication="false"
              -->
            <Ajp12Connector      port="8007" />
            <!-- Apache AJP13 support (mod_jk)
                 Parameter "address" defines network interface this Interceptor
                 "binds" to. Add it if you want to "bind" to just "127.0.0.1".
                 address="127.0.0.1"
                 Parameter "tomcatAuthentication", controls if Tomcat honors
                 ( and uses ) auth done in HTTP Server or not, when true Tomcat does
                 not use in any way auth information provided by the HTTP Server.
                 true is the default.
                 tomcatAuthentication="false"
              -->
            <Ajp13Connector port="8009" />
          <!--
               Context definitions can be placed here ( not recommended ) or
               in separate files. The ContextXmlReader will read all context
               definitions ( you can customize the "base" filename ).
               The default is conf/apps-[name].xml.
               See conf/apps-examples.xml and conf/apps-admin.xml 
           -->
        </ContextManager>
    </Server>

  • Get directory listing or files contained in a folder which is placed on a s

    Hello,
    I want to get the directory listing of a particular folder say 'xyz' which is placed on the server.
    I am using tomcat. I want to use Http to do it. How do it do it.
    Please guide.
    Regards,
    JAVA_student

    JAVA_student ,
    as pointed out file list is (in productional environments) usually turned off for security reasons.
    But I had a similiar requirement to the one you posted. I had a directory with thousands of image files with the name pattern <id>.jpg and the id's stored in a database. Not for every id in the database there existed a file. I wanted to show an image or in case the image file did not exist a default jpg. I could not set the error pages in web.xml to do it.
    So I had to take the id (a parameter in the request to the servlet I wrote for that), had to concat it with the 'virtual' directory name used in the applicationserver for the img directory. Then I had to check the existance of the file and to load it it and display it, if it existed otherwise I had to load and display the default picture.
    The problem is similiar to yours as the problem basically is to map a directory in a web application to a real directory in a filesystem (which works for files and directories.
    The answer is use getRealPath(String) of the ServletContext-object.
    Note: This only allows access to files and directories in the web application.
    e.g.
    http://www.theserver.com/mywebapp/img/ is a folder containing img files. The server does not allow directory listing.
    In a jsp within the application mywebapp you want to show a list of the files in /mywebapp/img/ .
    <HTML>
    <BODY>
    <%
    // in a jsp application gives you access to the context
    String sRealPath = application.getRealPath("/img") ;
    java.io.File fDir = new java.io.File(sRealPath) ;
    java.io.File[] allFiles = fDir.listFiles() ;
    for (int i = 0 ; i < allFiles.length;i++) {
       String sName = allFiles.getName() ;
    %>
    <%=sName%><br>
    <%
    %>
    </BODY>
    </HTML>

  • Create a new directory in server with JSP

    Hi,
    How can I create a directory in server with JSP.
    File dir = new File("a");
    dir.mkdir();
    does not work. what do I do?
    best regards,

    Hi
    Check the following things.
    1. What is the path where you are creating the directory.
    2. Do you permissions to create file in that directory.
    3. do a delete on that filename if that exists just to be sure. isdeleted = filedir.delete(). Check the boolean flag isdeleted too.
    Thanx and Regards
    Aruneesh

  • Remote  System Directory Listing/Navigation in JTree

    Hi
    I want my Remote System(Linux) directory listing to be available in a JTree. I need some help on implementing the same. Also How do i constantly get the directory structure of the remote system.
    Thanks in Advance

    http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html
    http://en.wikipedia.org/wiki/Model-view-controller
    How you get the data depends on how you access the server. Maybe FTP.

  • Very slow network directory listing - but fast data transfer speed once listed?

    Hello,
    I have really tried to sort this myself before opening up to the community, however I have run out of ideas, and hope someone can offer the magic solution I have missed.
    I am currently using the 3.4ghz i7 iMac on a 1GB LAN, running OSX10.7.2 - connecting to a Windows Server 2008 (Running Release 2) over ethernet.
    If i go to a network directory that i haven't recently accessed it can take up to 60 seconds to show the contents of that directory. Once i have accessed that folder, if i come out of it and go back in it will be instant again - but the first time it lists the directory it looks like i have opened an empty folder - which after anything from 10seconds to 1 minute will suddenly show the files that are there.
    Internet connectivity is fast through the network, and file transfers across the LAN are fast. (showing as approx 300mb per second) I can play and edit HD content across the network with no slowdown so I am confident that this issue is not related to the network speed itself, and is more to do with a setting on this mac.
    Symptoms are very similar to this post: https://discussions.apple.com/message/12245148?messageID=12245148&amp%3b#1224514 8 - however i understand that in OSX Lion - SMB was removed - so i cannot find this file to edit.
    I have tried bypassing additional hubs in the network by wiring direct cables to the switch that is connected to the file server, this made no difference.
    I have also tried disconnecting the ethernet cable, and running over wifi. This fixes the listing problem, but when editing HD content over a network drive, this connection is not fast enough to carry the data without interruption (some projects are linked to up to 900gb of hd video content!)
    Using ethernet, I have tried DHCP, DHCP with manual address, and manual mode. All reproduce this problem. i have tried using the windows workgroup, and tried without it.
    I have also followed this suggestion: https://discussions.apple.com/thread/2134936?threadID=2134936&tstart=45 and used OpenDNS. this did not fix the issue.
    For argument sake, I have also just tested a Macbook Pro running Snow Leopard to see if it was OS related. This reproduces the exact same problem, near instant directory listing on the wifi, a long and arduous wait on ethernet.
    I cannot work out why directory listing is instant over wifi, but not over ethernet on 2 different macs, running 2 different versions of OSX. I also do not understand why if the network is having trouble listing the directories - the data transfer speed is 300mbps when i copy files across the wired network from the file server to the mac.
    Does anyone have any other ideas as to what could be the problem here? We are about to start work on a very large project, where the content we are editing is spread out across around 200 different network folders (different shoots captured over the past 2 years). We really don't have the time to wait 60 seconds each time we need to access one of those directories to look for a file, and I am very close to pulling all my hair out!
    I really look forward to hearing from anyone who can offer any insight.

    If you are suspecting that the Windows update had something to do with your LAN going slow, then try the following:
    1.  Look for updates for your clients LAN NIC driver; or
    2.  Un-install the updates.

  • How to apply style sheet (.css) in Weblogic directory listing

    Hi,
    We are migrating a directory listing application from Apache to Weblogic.
    Earlier we did this by Apache httpd.conf entry like below :
    <Directory "/opt/apache/httpd-2.1.9/htdocs/Myreportfolder">
    IndexOptions FancyIndexing FoldersFirst NameWidth=* XHTML
    IndexOrderDefault Descending Date
    IndexStyleSheet "/css/style.css"
    </Directory>
    /opt/apache/httpd-2.1.9/htdocs folder has all it's usual resource files.
    We were able to see documents in "Myreportfolder".
    Now we have moved to Weblogic and using virtual directory mapping as below and we are trying to achieve the same thing:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <wls:weblogic-web-app xmlns:wls="http://www.bea.com/ns/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">
    - <wls:container-descriptor>
    <wls:index-directory-enabled>true</wls:index-directory-enabled>
    <wls:index-directory-sort-by>LAST_MODIFIED</wls:index-directory-sort-by>
    </wls:container-descriptor>
    - <wls:virtual-directory-mapping>
    <wls:local-path>/Myreportfolder</wls:local-path>
    <wls:url-pattern>/*</wls:url-pattern>
    </wls:virtual-directory-mapping>
    <wls:context-root>/getreports</wls:context-root>
    </wls:weblogic-web-app>
    We are able to view the reports but we do not get look-and-feel of Apache like directory listing.
    but we encounter below issues:
    1) File/Folder icons are not visible - we want to use style sheets in http header from the response that is returned from weblogic server
    2) Filename is limited to 29 characters when it is showing
    3) Files are not sortable as Descending order - we sorted using tag <wls:index-directory-sort-by>LAST_MODIFIED</wls:index-directory-sort-by> but the latest file is shown at the last
    We are thinking that Weblogic must be having some configuration like Apache httpd.conf where we can apply style sheets (css ).
    We would appreciate af anyone can provide better insight into the issue.
    or is it possible to extend weblogic.servlet.fileservlet class to serve this purpose.
    Thanks & regards,
    Rabi

    Hi Vikash,
    Check the below links which will you idea on the same.
    Stylesheet for WDA without integrating in SAP Portal
    Apply custom css to WebDynpro application
    Thanks
    KH

  • Front end directory listing

    Question:
    Trying to create a page that displays a directory list of a folder content.
    Don't want to use the literature module...
    Would like to create a folder where I easily can upload files (ftp) and create a menu link that displays the folder content as a list using my master template and css ...
    The files in the list should be available for download.
    Any suggestions on how to achieve this?
    Answer:
    This is not possible on BC. You can display a folder view and links to all the content in it. You'll have to upload your items and create a page with links to those items.

    That's a server message. Means what it says.

  • How do I populate an array with a directory listing.

    I have a web site that has its photos updated by another person using a content management system that I have written. As Dreamweaver does not know about these extra photos, if I try to
    syncronise the site on my machine for backup purposes, Dreamweaver downloads all 5000+ photos, and this can take upwards of 12 hours if there are no breaks in the connection.
    So I am trying to write a page that creates an array of the existing files on the remote site. It will then do the same on my local site, and by comparing the arrays, will make a list of the new files, and then download these, which will save a lot of time and bandwith charges.
    First I have to read the directory list, using the code below which reads and echos it on screen.
    However, I cannot work out how to populate the required array.
    <?php
        try
        {          /***photo directory ***/
            $it = new directoryIterator('../web/thumbs');
            while( $it->valid())
                  /*** echo if not a dot directory ***/
                if( !$it->isDot() )
    /**** Array creation code needs to go here I think.***/
    echo $it->current()."<br />";
         /*** move to the next element ***/
                      $it->next();
        catch(Exception $e)
            /*** echo the error message ***/
            echo $e->getMessage();
    ?>
    This creates a list of files and displays it on the page.
    How do I store it in an array?
    Howard Walker

    Although not the solution you were looking for, consider the following:
    Click the icon in DW for "Expand to show local and remote sites."  Arrange the remote image directory by "Modified date," Then select all the recent images and GET them.
    I find the above method good enough for occassional synchronization. I also simply ignore broken image links on the testing system.
    If the above is not a solid enough solution, perhaps someone else will write your array function for you. I don't have the time.

  • How to get a directory listing in XE?

    So how would you best get a directory listing?
    There was a lovely thread about using dbms_scheduler to make external calls:
    Re: External procedure calls supported?
    Which discussed how to run an external prcoedure. So using that technique would an approach be:
    create procedure get_dir(p_dir varchar2)
    --get sequence for directory call
    --call 'synronous dbms_scheduler that executes "ls -l > /tmp/listing[sequence]
    --create external table temp_dir_[sequence]
    --load it into a global temp table ala ASKTOM http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:439619916584
    --drop the external table
    Someone on Asktom said they were going to do it via dbms_pipe but was not forthcoming with an example.
    I'm not sure I like creating and dropping an external table every time this procedure is called and I feel I am missing a technique (or a good idea) to make this work effectively.
    Kind Regards,
    James
    Got the link to the 'External procedure calls support' wrong.
    Message was edited by: jcrockart

    Ok.
    Well here is the solution... Can I make it better?
    FROM OS (oracle user):
    vi ~/get_dir.sh
    #!/bin/sh
    ls $1 > /tmp/$2
    exit 0
    ##end
    FROM SYS:
    create directory OS_TMP as '/tmp';
    grant read,write on directory OS_TMP to hr;
    grant create table to hr;
    FROM HR:
    create global temporary table DIR_LIST
    ( filename varchar2(255) )
    on commit delete rows
    --create the following:
    CREATE OR REPLACE procedure get_dir_list (
    p_directory     in varchar2
    IS
    l_jobname VARCHAR2 (100);
    BEGIN
         l_jobname := DBMS_SCHEDULER.generate_job_name (prefix => 'get_dir_list');
         dbms_output.put_line(l_jobname);
         --dbms_output.put_line('ls '||p_directory||' > /tmp/blah');
         --creat syncrhous job
         DBMS_SCHEDULER.create_job (
              job_name => l_jobname,
              job_type => 'EXECUTABLE',
              job_action => '/home/oracle/get_dir.sh',
              number_of_arguments => 2,
              enabled => FALSE,
              comments => 'directory listing for '||p_directory);
         DBMS_SCHEDULER.set_job_argument_value (l_jobname, 1, p_directory);
         DBMS_SCHEDULER.set_job_argument_value (l_jobname, 2, l_jobname);
         -- Run job synchronously.
         DBMS_SCHEDULER.run_job (job_name => l_jobname, use_current_session => TRUE);
         -- Remove job after run
         DBMS_SCHEDULER.drop_job (l_jobname);
         --create external table
         execute immediate '
              create table '||l_jobname||'_ext
              file_name               varchar2(1000)
              organization external (
              type          oracle_loader
              default     directory os_tmp
              access parameters (
                   records delimited by newline
                   fields terminated by '',''
                   missing field values are null
                   file_name)
              location ('''||l_jobname||''')
              reject limit unlimited';
              execute immediate '
              INSERT INTO DIR_LIST(FILENAME) select file_name from '||l_jobname||'_ext
    END;
    --test it
    exec get_dir_list('/home/oracle')
    GET_DIR_LIST14
    PL/SQL procedure successfully completed.
    hr>select * from dir_list;
    FILENAME
    apex
    apex_3.0.1.zip
    get_dir.sh
    go.log
    go.txt
    test.sh
    6 rows selected.
    hr>
    Apologies for butchering Dietmar Aust dbms_schedule example.
    I can't drop the external table as the data in the global temporary table will be lost, so I will have to periodically clean up after this procedure.
    Please somebody feel free to give me the one line solution ;-)
    Regards,
    James

  • Directory listing of a Multi volume encrypted tapes on OpenVMS 8.3

    I have a full data backup for an openvms 8.3 server integrity server on two tapes that are encrypted.  If I mount the first volume and try to do a directory listing the process goes on indefinately; without giving any output and eventually I have to kill the process. e.g. DEV_DAISY> sh dev mk Device                  Device           Error    Volume         Free  Trans MntName                   Status           Count     Label         Space Count CntPLUTO$MKC200:           Online               0 DEV_DAISY> mount PLUTO$MKC200: dat801%MOUNT-I-MOUNTED, DAT801 mounted on _PLUTO$MKC200: DEV_DAISY> dir PLUTO$MKC200:[000000] The process goes on indefinately at this point of time. However If I mount the second volume and do a directory listing, It executes and gives me the required output as : Directory PLUTO$MKC200:[]DAT801.BCK;1 294976 31-MAR-2015 00:00:00.00Total of 1 file, 294976 blocks. I want to ask is it possible to do a directory listing on first volume. If not is it possible to read tape header information (i.e saveset name and date on which backup was taken) from the first volume without specifying the encryption key.

    I have a full data backup for an openvms 8.3 server integrity server on two tapes that are encrypted.  If I mount the first volume and try to do a directory listing the process goes on indefinately; without giving any output and eventually I have to kill the process. e.g. DEV_DAISY> sh dev mk Device                  Device           Error    Volume         Free  Trans MntName                   Status           Count     Label         Space Count CntPLUTO$MKC200:           Online               0 DEV_DAISY> mount PLUTO$MKC200: dat801%MOUNT-I-MOUNTED, DAT801 mounted on _PLUTO$MKC200: DEV_DAISY> dir PLUTO$MKC200:[000000] The process goes on indefinately at this point of time. However If I mount the second volume and do a directory listing, It executes and gives me the required output as : Directory PLUTO$MKC200:[]DAT801.BCK;1 294976 31-MAR-2015 00:00:00.00Total of 1 file, 294976 blocks. I want to ask is it possible to do a directory listing on first volume. If not is it possible to read tape header information (i.e saveset name and date on which backup was taken) from the first volume without specifying the encryption key.

Maybe you are looking for

  • Due Date on Reconciliation printout

    Dear All, In the Automatic Reconciliation - General/Manual - for a GL Account - Internal there is a field called Due Date, which displays the Due Date from the Journal Entry. We have a client who prints out this screen before doing the reconciliation

  • Lumia 620 Music & Hotmail

    Nokia music shows the same songs around 4-5 times. THough the memory card has the capacity 8 gb but the storage setting is showing 12 gb. Please tell me hw to rectify it as its irritating alot. The same thing is happening with hotmail. I have 2 icons

  • L5780: first page or 2 print fine then poor quality print

    The first few pages of print will be fine but then towards the end of the 3rd page there are horizontal streaks, the next page will be full of them getting worse as the page progresses.  I can wait a while (1/2 hour or so) get a good page but then ba

  • Installing a VB application using Oracle Provider for OLEDB

    Hi all, I have a corporate VB application that uses the Oracle 9i client. The Oracle Client is on a network disk, so all my clients will not need to install on their client machines. I am using Wise for Windows Installer to install the application on

  • Proxy to JDBC a small issue

    Hi friends, I had a scnario where i am using proxy to JDBC this is sync scnario. when i am triggring the proxy with help of a report. If the data is present every thing is working fine.. in one case if data is not there in the sender side . mean payl