Listing files on a web directory

Hi,
I would like to write an application that looks at a certain web directory and reports when a new file is uploaded onto that directory, and returns the URL of the file. I am looking for something like the 'File' class' listFiles() method, to determine if a new file has been uploaded, but I can't find an analogous funtion for directories on the web. Can someone point me in the right direction here?
Thanks,
Chester

Sorry, I should have searched the forum first.....I found an answer.
-chester (new to these forums)

Similar Messages

  • List files stored in a Directory Object

    Hi,
    I looked on Google, on Oracle DB docs and here to find a convenient way to list files stored in a DIRECTORY for batch loading in a table with PL/SQL. But no luck, UTL_FILE doesn't seem to have a method for directory listing. I saw examples with some workaround like putting files list in a text file prior to loading. The directory is feeded by other process and network services, so I don't know the filelist that I need to import and, then delete. I dont have access to the server console and it's impossible for me to dump a kind of «dir» result into a text file. I saw other examples using Java, but it looks like I don't have access to Server Side Java too.
    Is there a simple way to do that in PL/SQL only?
    If not, I'll ask to the DBA the necessary rights to compile/run java on the server side...
    The DB target versions for this requirement are 10g and 11g (mainly) on Windows environment.
    Thanks
    Bruno

    brlav35 wrote:
    The XUTL_FINDFILES seems to be the more convenient way. If that works for you, I certainly have no objection. In a lot of environments, though, that package would be problematic.
    1) It must be installed in the SYS schema. That's generally frowned upon and lots of sites would never allow user code to go into the SYS schema. Chris is a bright guy, so I'm sure the risk of it causing harm is minimal (most likely during an install or upgrade), and it will almost certainly never cause you harm, but that would be a political show-stopper at a lot of places.
    2) The package body is wrapped (if there is a version with the package body in clear text, this point is moot). Again, Chris is a well-respected guy, so I have every confidence that the code is not malicious, but asking a DBA to install a wrapped package you downloaded from the internet into the SYS schema on a production database should generate a crud-load of red flags. This is almost certainly just a theoretical danger, but DBAs and audit compliance regulations care a great deal about theoretical dangers. If someone hacked the web site and uploaded their own wrapped bit of code that had a back door, for example, it would be very hard to catch.
    3) Under the covers, the package is querying one of the undocumented X$ views. Oracle is free to change those views over time, which would potentially cause the package to stop working or stop working correctly in some way. If you're developing code for a system that may be around for a number of years, that becomes a concern. It's unlikely that Oracle will change the particular X$ view that is being referenced here over the lifetime of your code base, but it's more than a trivial concern.
    4) The package is determining what directories a user has access to, that's not Oracle enforcing the restriction. Probably not too big a deal, but it is probably safer from a regulatory compliance standpoint to be able to rely on Oracle the database enforcing privileges rather than relying on a delivered package to enforce those privileges. It's the difference between telling Oracle via specific grants which directories the JVM can access vs. writing your own wrapper that enforces those restrictions. In the end, the restrictions are enforced, but in one case you're relying on the developers of the Oracle database and in the other you're relying on external developers.
    Just to re-iterate-- Chris is a brilliant guy, I don't mean this in any way to impugn him or his code. I am totally confident that his code works, that it works well, and that it will continue to work going forward. My concerns are purely on the political/ regulatory side of things, not on the technical side of things. Technically, I am confident that the code is top-notch.
    Justin
    Edited by: Justin Cave on Sep 9, 2009 12:38 PM
    I wrote this before seeing the last few bits of the exchange where you and Chris already talked about the first point.

  • Getting the files from a web directory...?

    Sigh I've spent the last couple hours googling, forum searching, API sweeping, and experimenting.. I just can't figure this one out.
    I've got a game which reads levels from a text file. This is all fully functional. I've decided that I want my game to be able to query some website which I will be using for free hosting (Currently an ftp server) with all the levels in a folder called "newLevels", to get a list (Preferably in array format, but any list will do.) of the names of the files inside the folder. For example: At ftp://address/newLevels, there are currently three files. "Claustro.lvl", "DragonFort.lvl", and "Surlicster.lvl". All files within this folder will have the ".lvl" extension. My extensive google-research has helped me to find a class that will copy a file from a server to hard disk. But I will have no way of knowing which files are on the server, unless I have every client write a new level name to a text field. But in this case.. What's the point in having an auto-updater in the first place? Does anybody know of some sort of way to get a list of what is in a web based folder? Sadly, there's no such thing as a URL.list() method, which really sucks.

    Thanks for the suggestion. I guess I'll just stick to FTP, then. I developed an idea that seem to work for two different ftp servers (My personal one, and the one provided by funpic.org) while waiting for a reply.
    I found an algorithm written by someone else that reads in an ftp page, and displays every single character. There was a consistency here: read/write priveledges, date modified, etc etc. They were all seperated by spaces. And then eventually the filename. I told it to count the 'words' (sets of characters seperated by spaces) until it reached 9, at this point, it has reached the filename. It reads until the filename being saved (one character at a time) has a '.lvl' at the end, and then it resets those counting variables, and stores the filename in a vector aptly named 'files'.
    I used another algorithm written by some other person that downloads files from an ftp, and sent it the filenames one at a time.
    It's working for me, but I'm not sure if this would be considered 'disgustingly inefficient' by the superiors of programming.

  • Listing files on the webcontent directory that including .jsp files

    Hi ,
    I want to list all files on the directory that including .jsp files . How can I do this ?
    �f I use the following code in the jsp:
    java.io.File file = new java.io.File(".");
    String[] files= file.list();
    it returns me application server 's directory files. But I want to see webcontent directory files.

    You can use the method of ServletContext - getRealPath() to turn a website relative location into a real place on disk.
    In a generic way:
      <%
        String dir = application.getRealPath(request.getServletPath());
        File jspFile = new File(dir);
        File jspDir = jspFile.getParentFile();
        File[] files = jspDir.listFiles(); 
      %>Cheers,
    evnafets

  • How to list files from a remote directory?

    Hi,
    I have a user interface on a PC that needs to display a directory listing of a remote RT processor.  I don't want to have the RT to use List Directory function and the PC to get this result... I'm sure there's a cleaner way to do that with FTP or DataSocket.  I've tried FTP, but it stalls in FTP Directory Listing.vi.
    Any ideas?
    Thanks!
    Patrick.

    There are a number of reasons why the Directory lister can hang. The best thing to do is try the "FTP browser.vi" found in the example finder. If you have the internet toolkit it will show up if you search for "FTP." In this example program, type in your RT unit's IP address and see if you can browse the directory structure. If it works you can use any portion of this program in your own application. Hope this helps.

  • Issue with List Files option in FTP Adapter-

    Hi All,
    I am getting the following error when I am using the list files option inside FTP adapter. The soa Version I am using is 11.1.1.5
    Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'FileListing' failed due to: Error in listing files in the remote directory. Error in listing files in the remote directory. Unable to list file in remote directory. Please make sure that the ftp server settings are correct. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution.
    I have configured FTP adapter successfully by giving the following details,
    useSftp –
    username –
    password -
    host -
    port –
    authenticationType –
    preferredCipherSuite -
    and it is working perfectly for getfiles option and it is reading files successfully, but it is throwing error when I am using list files option. I tried this option for listing the files that are in remote directory. Any Help would be appreciated.
    Complete fault
    <messages>
    <input>
    <Invoke1_FileListing_InputVariable>
    <part name="Empty">
    <empty/>
    </part>
    </Invoke1_FileListing_InputVariable>
    </input>
    <fault>
    <bpelFault>
    <faultType>0</faultType>
    <bindingFault>
    <part name="summary">
    <summary>Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'FileListing' failed due to: Error in listing files in the remote directory. Error in listing files in the remote directory. Unable to list file in remote directory. Please make sure that the ftp server settings are correct. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution. </summary>
    </part>
    <part name="detail">
    <detail>No such file</detail>
    </part>
    <part name="code">
    <code>null</code>
    </part>
    </bindingFault>
    </bpelFault>
    </fault>
    <faultType>
    <message>0</message>
    </faultType>
    </messages>
    May 9, 2013 4:32:00
    Edited by: BK574 on May 9, 2013 2:47 PM

    Is this a bug in SOA suite?
    Following are the properties inside JCA file
    <adapter-config name="List" adapter="FTP Adapter" wsdlLocation="List.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
    <connection-factory location="eis/ftp/FTPService" UIincludeWildcard="*.*"/>
    <endpoint-interaction portType="FileListing_ptt" operation="FileListing">
    <interaction-spec className="oracle.tip.adapter.ftp.outbound.FTPListInteractionSpec">
    <property name="PhysicalDirectory" value="*.*"/>
    <property name="Recursive" value="true"/>
    <property name="IncludeFiles" value="*.*"/>
    </interaction-spec>
    </endpoint-interaction>
    </adapter-config>
    Edited by: BK574 on May 10, 2013 6:30 AM
    Edited by: BK574 on May 10, 2013 6:31 AM

  • Authentication on web directory

    Good day.
    I must to write a file in a web directory from servlet.
    I should want to restrict to a specific user the read/write/execute permission.
    In this mode my servlet not write a file from a servlet (permission denied).
    FileOutputStream fos = new FileOutputStream(getServletContext().getRealPath("/mcfoto/foto1.png"));
    How can I set the username (and the password) qualified to create a file in it?
    Best regards.
    Stefano Errani

    Good day.
    I've tried to set the permission directory at read only and then I've tried to write a file in it.
    The result is an error for permission denied.
    I believe not to have understood the answer.
    Best regards.
    Stefano Errani

  • Recipient list files ?

    What would the @ number be in the messageid for recipient list files in
    ..\offiles ?
    Cheers Dave
    Dave Parkes [NSCS]
    Occasionally resident at http://support-forums.novell.com/

    If you are trying to find the recipient list file in the
    offiles directory, there is not away to do that currently.
    If that what you are ask for?
    Preston
    >>> On Tuesday, May 01, 2012 at 11:07 AM, Preston
    Stephenson<[email protected]> wrote:
    > Sorry, I don't understand what you are asking and in what context.
    >
    > If you want the path to the attachment in the offiles directory,
    > you can specify "ReturnPath" when getting an attachment with
    > getAttachmentRequest.
    >
    > Here is an example:
    > <?xml version="1.0" encoding="UTF‑8"?>
    > <env:Envelope
    > xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    > xmlns:xsi="http://www.w3.org/2001/XMLSchema‑instance"
    > xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
    > xmlns:ns0="http://schemas.novell.com/2005/01/GroupWise/methods">
    > <env:Header>
    > <ans1:session
    > xmlns:ans1="http://schemas.novell.com/2005/01/GroupWise/types">hv4Tmcdjv2
    > KVq
    > S5_</ans1:session>
    > <ans1:gwTrace
    >
    xmlns:ans1="http://schemas.novell.com/2005/01/GroupWise/types">false</ans1
    > :g
    > wTrace>
    > </env:Header>
    > <env:Body>
    > <ns0:getAttachmentRequest>
    >
    >
    <ns0:id>4F3A1944.domain.PO1.200.2000000.1.89D.1@45 :4F3A1944.domain.PO1.100
    > .1
    > 776172.1.46C97.1@1:7.domain.PO1.100.0.1.0.1@16</ns0:id>
    > <ns0:offset>0</ns0:offset>
    > <ns0:length>0</ns0:length>
    > <ns0:flags>ReturnPath</ns0:flags>
    > </ns0:getAttachmentRequest>
    > </env:Body>
    > </env:Envelope>
    >
    > <?xml version="1.0" encoding="UTF‑8"?>
    > <env:Envelope
    > xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
    > xmlns:xsi="http://www.w3.org/2001/XMLSchema‑instance"
    > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    > xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    > <env:Header/>
    > <env:Body>
    > <gwm:getAttachmentResponse
    > xmlns:gwm="http://schemas.novell.com/2005/01/GroupWise/methods"
    > xmlns:gwt="http://schemas.novell.com/2005/01/GroupWise/types">
    > <gwm:part
    > path="\\pstephenson1.provo.novell.com\data\autotes t\domain\po1\offiles\f
    > d40\
    > 4f3a1944.001"/>
    > <gwm:status>
    > <gwt:code>0</gwt:code>
    > </gwm:status>
    > </gwm:getAttachmentResponse>
    > </env:Body>
    > </env:Envelope>
    >
    > Preston
    >
    >>>> On Tuesday, May 01, 2012 at 10:22 AM, Dave
    > Parkes<DParkes@no‑mx.forums.novell.com> wrote:
    >> What would the @ number be in the messageid for recipient list files in
    >> .\offiles ?
    >>
    >> Cheers Dave

  • 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?

  • Getting a list of files from a shared directory

    Hi All,
    I need to get a list of files from a shared directory on another server and put them in a HTMLB TableView element with links to the files.
    I was not successful with CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES. This method works in test mode, but gives me a gui_not_supported exception in BSP. I guess BSPs are not allowed to use this.
    Is there any other alternative?
    I need to be able to upload the files as well.
    Thanks,
    Roman
    Message was edited by: Roman Dubov

    Hi again,
    Not sure about the shared directory files list...
    In my opinion, this cannot be done using BSP.
    But, you can try using VBScript to access the file system with object of that sort :
    CreateObject("Scripting.FileSystemObject")
    it is only a thought and you can be sure to cross security problems by accessing files through a Web application...
    Best regards,
    Guillaume

  • How can i get also the files in the root directory and how can i for testing add items of IEnumerable FTPListDetail to List string ?

    What i get is only the directories and files that in other nodes. But i have also files on the root directory and i never
    get them. This is a screenshot of my program after i got the content of my ftp. I'm using treeView to display my ftp content:
    You can see two directories from the root but no files on the root it self. And in my ftp server host i have files in the root direcory.
    This is the method i'm using to get the directory listing:
    public IEnumerable<FTPListDetail> GetDirectoryListing(string rootUri)
    var CurrentRemoteDirectory = rootUri;
    var result = new StringBuilder();
    var request = GetWebRequest(WebRequestMethods.Ftp.ListDirectoryDetails, CurrentRemoteDirectory);
    using (var response = request.GetResponse())
    using (var reader = new StreamReader(response.GetResponseStream()))
    string line = reader.ReadLine();
    while (line != null)
    result.Append(line);
    result.Append("\n");
    line = reader.ReadLine();
    if (string.IsNullOrEmpty(result.ToString()))
    return new List<FTPListDetail>();
    result.Remove(result.ToString().LastIndexOf("\n"), 1);
    var results = result.ToString().Split('\n');
    string regex =
    @"^" + //# Start of line
    @"(?<dir>[\-ld])" + //# File size
    @"(?<permission>[\-rwx]{9})" + //# Whitespace \n
    @"\s+" + //# Whitespace \n
    @"(?<filecode>\d+)" +
    @"\s+" + //# Whitespace \n
    @"(?<owner>\w+)" +
    @"\s+" + //# Whitespace \n
    @"(?<group>\w+)" +
    @"\s+" + //# Whitespace \n
    @"(?<size>\d+)" +
    @"\s+" + //# Whitespace \n
    @"(?<month>\w{3})" + //# Month (3 letters) \n
    @"\s+" + //# Whitespace \n
    @"(?<day>\d{1,2})" + //# Day (1 or 2 digits) \n
    @"\s+" + //# Whitespace \n
    @"(?<timeyear>[\d:]{4,5})" + //# Time or year \n
    @"\s+" + //# Whitespace \n
    @"(?<filename>(.*))" + //# Filename \n
    @"$"; //# End of line
    var myresult = new List<FTPListDetail>();
    foreach (var parsed in results)
    var split = new Regex(regex)
    .Match(parsed);
    var dir = split.Groups["dir"].ToString();
    var permission = split.Groups["permission"].ToString();
    var filecode = split.Groups["filecode"].ToString();
    var owner = split.Groups["owner"].ToString();
    var group = split.Groups["group"].ToString();
    var filename = split.Groups["filename"].ToString();
    var size = split.Groups["size"].Length;
    myresult.Add(new FTPListDetail()
    Dir = dir,
    Filecode = filecode,
    Group = group,
    FullPath = CurrentRemoteDirectory + "/" + filename,
    Name = filename,
    Owner = owner,
    Permission = permission,
    return myresult;
    And then this method to loop over and listing :
    private int total_dirs;
    private int searched_until_now_dirs;
    private int max_percentage;
    private TreeNode directories_real_time;
    private string SummaryText;
    private TreeNode CreateDirectoryNode(string path, string name , int recursive_levl )
    var directoryNode = new TreeNode(name);
    var directoryListing = GetDirectoryListing(path);
    var directories = directoryListing.Where(d => d.IsDirectory);
    var files = directoryListing.Where(d => !d.IsDirectory);
    total_dirs += directories.Count<FTPListDetail>();
    searched_until_now_dirs++;
    int percentage = 0;
    foreach (var dir in directories)
    directoryNode.Nodes.Add(CreateDirectoryNode(dir.FullPath, dir.Name, recursive_levl+1));
    if (recursive_levl == 1)
    TreeNode temp_tn = (TreeNode)directoryNode.Clone();
    this.BeginInvoke(new MethodInvoker( delegate
    UpdateList(temp_tn);
    percentage = (searched_until_now_dirs * 100) / total_dirs;
    if (percentage > max_percentage)
    SummaryText = String.Format("Searched dirs {0} / Total dirs {1}", searched_until_now_dirs, total_dirs);
    max_percentage = percentage;
    backgroundWorker1.ReportProgress(percentage, SummaryText);
    percentage = (searched_until_now_dirs * 100) / total_dirs;
    if (percentage > max_percentage)
    SummaryText = String.Format("Searched dirs {0} / Total dirs {1}", searched_until_now_dirs, total_dirs);
    max_percentage = percentage;
    backgroundWorker1.ReportProgress(percentage, SummaryText);
    foreach (var file in files)
    TreeNode file_tree_node = new TreeNode(file.Name);
    file_tree_node.Tag = "file" ;
    directoryNode.Nodes.Add(file_tree_node);
    numberOfFiles.Add(file.FullPath);
    return directoryNode;
    Then updating the treeView:
    DateTime last_update;
    private void UpdateList(TreeNode tn_rt)
    TimeSpan ts = DateTime.Now - last_update;
    if (ts.TotalMilliseconds > 200)
    last_update = DateTime.Now;
    treeViewMS1.BeginUpdate();
    treeViewMS1.Nodes.Clear();
    treeViewMS1.Nodes.Add(tn_rt);
    ExpandToLevel(treeViewMS1.Nodes, 1);
    treeViewMS1.EndUpdate();
    And inside a backgroundworker do work how i'm using it:
    var root = Convert.ToString(e.Argument);
    var dirNode = CreateDirectoryNode(root, "root", 1);
    e.Result = dirNode;
    And last the FTPListDetail class:
    public class FTPListDetail
    public bool IsDirectory
    get
    return !string.IsNullOrWhiteSpace(Dir) && Dir.ToLower().Equals("d");
    internal string Dir { get; set; }
    public string Permission { get; set; }
    public string Filecode { get; set; }
    public string Owner { get; set; }
    public string Group { get; set; }
    public string Name { get; set; }
    public string FullPath { get; set; }
    Now the main problem is that when i list the files and directories and display them in the treeView it dosen't get/display
    the files in the root directory. Only in the sub nodes.
    I will see the files inside hello and stats but i need also to see the files in the root directory.
    1. How can i get and list/display the files of the root directory ?
    2. For the test i tried to add to a List<string> the items in var files to see if i get the root files at all.
       This is what i tried in the CreateDirectoryNode before it i added:
    private List<string> testfiles = new List<string>();
    Then after var files i did:
    testfiles.Add(files.ToList()
    But this is wrong. I just wanted to see in testfiles what items i'm getting in var files in the end of the process.
    Both var files and directoryListing are IEnumerable<FTPListDetail> type.
    The most important is to make the number 1 i mentioned and then to do number 2.

    Risa no.
    What i mean is this. This is a screenshot of my ftp server at my host(ipage.com).
    Now this is a screenshot of my program and you can see that in my program i have only the directories hello stats test but i don't have the files in the root: htaccess.config swp txt 1.txt 2.png....all this files i don't have it on my treeView.
    What i want it to be is that on my program on the treeView i will also display the files like in my ftp server.
    I see in my program only the directories and the files in the directories but i don't see the files on the root directory/node.
    I need it to be like in my ftp server i need to see in my program the htaccess 1.txt 2.png and so on.
    So what i wrote in my main question is that in the var files i see this files of the root directory i just don't know to add and display them in my treeView(my treeView is treeViewMS1).
    I know i checked in my program in the method CreateDirectoryNode i see in the first iteration of the recursive that var files contain this root files i just dont know how to add and display them in my treeView.
    On the next iterations when it does the recursive it's adding the directories hello stats test and the files in this directories but i need it to first add the root files.

  • Listing files of directory on application server

    hi all,
    I want to download a list of files from the application server.
    I tried the functions:
    - SUBST_GET_FILE_LIST
    - EPS_GET_DIRECTORY_LISTING
    - RZL_READ_DIR_LOCAL
    but the result gives me the name of my file truncated.
    My filename is much longer than the functions give me.
    Is there any other function, or can i bypass this problem in a way.
    Thanks in advance.
    Merijn.

    Hello,
    This is a common problem with this FMs. Even SAP acknowledges this:
    In EPS_GET_DIRECTORY_LISTING you have this:
    data: begin of file,
            dirname(75) type c, " name of directory. (possibly truncated.)
            name(75)    type c, " name of entry. (possibly truncated.)
          end of file.
    The FM uses a Kernel Call 'C_DIR_READ_NEXT' to get the list of the files in the directory. The file name is returned in the field file-name.
    call 'C_DIR_READ_NEXT'
              id 'TYPE'   field file-type
              id 'NAME'   field file-name
              id 'LEN'    field file-len
              id 'OWNER'  field file-owner
              id 'MTIME'  field file-mtime
              id 'MODE'   field file-mode
              id 'ERRNO'  field file-errno
              id 'ERRMSG' field file-errmsg.
    The program RSWATCH0(trxn: AL11) also uses the Kernel call but the structure file is different.
    DIrectory name can be 1024 character long & file name is 260 character long
    data: begin of file,
            dirname(1024)    type c,  " name of directory. (possibly
                                           " truncated.)
            name(260)        type c, " name of entry. (possibly
                                           " truncated.)
            type(10)    type c,            " type of entry.
            len(8)      type p,            " length in bytes.
            owner(8)    type c,            " owner of the entry.
            mtime(6)    type p, " last modification date, seconds since 1970
            mode(9)     type c, " like "rwx-r-x--x": protection mode.
            useable(1)  type c,
            subrc(4)    type c,
            errno(3)    type c,
            errmsg(40)  type c,
            mod_date    type d,
            mod_time(8) type c,            " hh:mm:ss
            seen(1)     type c,
            changed(1)  type c,
          end of file.
    So one workaorund would be to copy EPS_GET_DIRECTORY_LISTING to some custom FM & change the length of the structure file to suit your requirement
    BR,
    Suhas
    PS: Use of Kernel Call is for internal use only & is highly not recommended by SAP.

  • List files in directory?

    Hey there. I'm brand new to this JSP stuff. I'm developing a solution whereby a customer logs into a page, the page looks into a directory for invoices associated with that customer (this will be accomplished through naming conventions) and then gives the customer a dropdown with their invoices in it. I wanted to start with the simplest part of the code and work forward with the conditions etc. So what I want to do first is just get the page to list all the files in the invoices directory. Can anyone help me with that?
    Thanks!

    Q&D, should list the current directory contents.
    I want to do first is just get the page to list all
    the files in the invoices directory. Can anyone helpimport javax.swing.*;
    import java.util.*;
    import java.io.*;
    import java.io.OutputStream.*;
    import java.io.InputStream.*;
    import java.util.zip.*;
    import java.text.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.Date;
    import javax.swing.table.*;
    import java.net.URL;
    import java.sql.*;
    import java.net.*;
    public class Servlet extends HttpServlet {
    public final static String IPAddress = "127.0.0.1";
    public final static String IPAddressKey = "ipaddress";
    public Servlet()
    public void init(ServletConfig conf) throws ServletException {
         super.init(conf);
    public void doPost (HttpServletRequest req, HttpServletResponse res)
         throws ServletException, IOException {
         HttpSession session = req.getSession( true );
         String sessionID = session.getId();
         session.putValue( "sessionID", sessionID );
         session.putValue( IPAddressKey, IPAddress );
         ServletContext sc = null;
         RequestDispatcher rd = null;
         String url = "/Dir.jsp";
         sc = getServletContext();
         rd = sc.getRequestDispatcher( url );
         System.out.println( "S url forward " + url );
         rd.forward( req, res );
    <html>
    <%@ page session="false" language="java" import="java.io.*" %>
    <body bgcolor="white">
    <font size=4>
    <%
         try {
         File f = new File( "." );
         File[] fs = f.listFiles();
         for( int i = 0, ii = fs.length; i < ii; i++ )
              %>
    <%= fs[ i ] %><br>
    <%
         } catch (Exception e) {
         System.err.println(e);
    %>
    </font>
    </body>
    </html>

  • File with list of .txt files in a specific directory

    Hi,
    I need to create a file with list of .txt files in a specific directory (actually the command will be used by a java application).
    I am using the below command,
    ls home/apptmt/park/*.txt > home/apptmt/park/reportgen.txt
    but this command prints output as
    home/apptmt/park/report1.txt
    home/apptmt/park/report2.txt
    home/apptmt/park/report3.txt
    I need only the files in reportgen.txt file, like
    report1.txt
    report2.txt
    report3.txt
    any one help me on the command I should use to get this output?
    Thanks
    MT

    Thank you Dude!
    I just found out that
    cd /home/apptmt/park;ls *.txt > reportgen.lst works for me...
    I will try this one as well... thank you very much...
    MT

  • How to List files in a directory into an Array

    Does anyone know of the best way to load all of the files in a specified directory into an array. (not going into sub directories either).
    I was to be able to do something like this.... (pseudo)
    String directory = "C:\";
    String [] theList;
    do
    get next file name;
    add to theList;
    }while(!End of Directory)
    Done.

        public static void main(String args[]) {
         String directory = "C:\\";
         File dir = new File(directory);
         File [] theList = dir.listFiles();
         for(File file : theList)
             if(!file.isDirectory() && !file.isFile())
              System.out.println(file.getName());
         }This will list every item in the coot of C:\ that is not a file or a directory. Change the if statement to fit your needs.
    ~Tim

Maybe you are looking for

  • FM or BAPI to test HU creation using Packing instruction in test mode

    Hi SAP Gurus, Can you guys help me in finding out an appropriate FM or BAPI thourgh which systme will create HU using Packaging instructions. I have Packaging instructions are setup as master record and Determination proceudre is also created. Just w

  • Too much noise!!

    hi, i have a dual 1gb quicksilver 2002, the fan are terrible... too much noise! i hear about a kit (easy to put into my mac) that makes the fan not so much noise, can you give me the link of the seller? thank you so much igor

  • Summary data is incorrect

    My summary data stats are not adding up correctly for a specific form that I created.  I am not sure where is problem is generating from.

  • Photo preview blank when browsing Aperture Library from iPhoto

    Hello to everyone, I need to import in iPhoto some photo of my Aperture's Library, but when I open it from iPhoto I can see all the pictures exept the lastest that I've imported in the Aperture Library (that have been taken with a Canon EOS 550D with

  • How to run cpl as local administrator

    Hi! We have a user that works on graphics and he needs to run "Adobe Gamma.cpl". But when he tries to run, it shows a message that only administrators can run it: "To be able to run Adobe Gamma you must log on with Administrator Privileges". I tried