Searching file from directory located at http path.

Hi All,
I have made the program to search for a file in a directory and its subdirectories. This is working fine when my directory is located on local machine. But if the same directory is placed in HTTP path, the code fails to search a directory. Does anyone has idea how can i connect to site so as to access the directories. I used URL and URLConnection to read and write file to the site, and this is also working fine but when it comes to directories i find no solution. Please help.

This works fine if i map http://flash/ on my C: and
try to list files in directory C:\Mojo. Can you please
tell how can i know whether the http server i am
trying to access allows directory listing or not.
Because if it does not i have administrator rights on
the server and i can make the changes required.You can see if your Web server allows directory listing by simply
typing in the URL you want to examine, inside your browser, and see if
it shows you a directory listing. For instance, if you type in:
http://flash/Mojo/
in your browser's address bar, and you see a list of files in that
directory, then your Web server supports directory listing.
Note, though, that you can't use the File list() method to get a list of files.
You'll have to make a connection, read the input stream, and then parse
the filenames out of the HTML that the Web server returns. (You can see
what the HTML looks like, by doing View Source inside your brower. That's
what you'll get back from your Java program.)
--Steve

Similar Messages

  • Delete File from URL located on HTTP Server.

    Hello All, could you anybody help me with my Problem. I need to delete some File in URL located on HTTP Server. The File was created via using of the Function 'DP_CONTROL_SEND_STREAM_TO_URL'. Any Times I need to delete this File from the url Location, but I cann't find any Functions or Method of any Class (GUI 6.20) to realise that. I read lot of very good Blogs from Thomas Jung about HTTP classes, but I cann't find somthing relevant for me...
    Sincerely Yours,
    Lubomir

    Hi,
    You can try with GUI_DELETE_FILE and give http location in FILE_NAME
    or WS_FILE_DELETE.
    I am not getting any CNDP function module for your purpose.
    Hope you will get sucess..
    Thanks,
    Chetan Shah

  • WPF - Get files from directory with a shorter path

    Hello,
    I want to list the files in a combobox. My main question is how to get those files? I saw Directory.GetFiles(path), but I have to write the whole path (C:\Folder1\Folder2\Folder3\Folder4). How will this work on an other PC? Is somehow possible to write
    the path beginning just form the app's folder? For example: the .exe is in "C:\Folder1\Folder2", and now the path what I have to write is just ":\Folder3\Folder4".
    Thanks!

    I may be misunderstanding; please correct me if I am.  It sounds like you want to get a list of the files in the same directory as the program that's executing.  
    //A few ways to get files from the same location as the code that is executing:
    //Enumerate through each file
    foreach(var fileInfo in new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).Directory.EnumerateFiles())
    //Get a collection of file information objects
    System.IO.FileInfo[] fileInfos = new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).Directory.GetFiles();
    //Get the name of the directory
    string directoryName = new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).DirectoryName;
    WinSDK Support Team Blog: http://blogs.msdn.com/b/winsdk/

  • Need Help: Have to route file from directory to directory in same system

    Hi Experts,
    I need to route xml file from one directory to another and then to another one in the local system. For example, i have the file in directory A, i need to delete that file from that location and place it in B and then from B i have to move it to A again and then move it to C.
    The path will be:     A-> B -> A -> C
    where A, B, C are folder names
    How can i do that in SAP-XI in ID? Do i need to create two communication channels? Please guide me and help me out of this.

    Hi Arkesh,
    >>For example, i have the file in directory A, i need to delete that file from that location and place it in B and then from B i have to move it to A again and then move it to C.
    For doing this why you need SAP PI? you can better do this with a script or batch job.
    >>A-> B -> A -> C
    A to B will be one interface and B-->A will be another one. The file getting picked from A and getting dropped to A (in second scenrio) shoudl not have the same name else these two interfaces will go in a loop.
    A to C will be the third scenario
    each scenario will have a sender file adapter and a receiver file adapter.
    But still I didn't get the business usage or usage of PI in this case
    Regards
    Suraj

  • How to copy file from  one location to another

    Hi,
    I am new to java, I tried the following code to move the file from one location to another
    public class CopyFiles {
    public String copy ( File source, File target)
    throws IOException {   
    FileChannel sourceChannel = null;
    FileChannel targetChannel =null;
    try {   
    sourceChannel =new FileInputStream(source).getChannel();
    targetChannel= new FileOutputStream(target).getChannel();
    targetChannel.transferFrom(sourceChannel, 0,
    sourceChannel.size());
    finally {   
    targetChannel.close();
    sourceChannel.close();
    return "Success";
    public static void main(String [] args) throws Exception{   
    File source = new File("C:\\users\\download.pdf");
    File destinationFile = new File("C:\\apple\\download.pdf");
    copy(source, destinationFile);
    The above code is working perfectly, but I Don't want to include the file name in destination file. i.e. File destinationFile=new File("C:\\apple"), and at the same time the pdf with same name has to get stored in the destination location, how can I achieve this.

    kameshb wrote:
    I Don't want to include the file name in destination file. i.e. File destinationFile=new File("C:\\apple"), and at the same time the pdf with same name has to get stored in the destination location, how can I achieve this.It's not totally clear what you're saying here, but what I think you mean is that you don't want to explicitly set the destination file name--you want to just give the copy the same name as the original. Yes?
    If that's the case, then break the original up into separate directory and file name portions, and then construct the destination path from the destination directory plus original file name. You can do that by manipulating the full path string, or by using the methods in java.io.File.

  • How to access Excel files from different locations?

    Hello,
    I have successfully tested the Excel sample on WLS 7, and trying to run it on
    the WLS 8.1.
    Anyways, the common question for both is, how to access an excel files from different
    locations (e.g. c:\path\1.xls, \\domain1\finance\fin.xls, \\domain1\marketing\customer.xls,
    \\domain2\accounts\vouchers.xls)?
    From example i can see that it picks from a specific path under repository.
    Thanks
    Ashok Gupta

    The custom function sets the MS-Excel default directory to System.getProperty("user.dir")+"/excel"
    (the domain directory), then opens the filename passed as a parameter. I assume
    that if you pass in the fully specified path for the excel file ( like d:\MyDir\data\test.xls),
    that it would open that file.
    - Mike
    "Ashok Gupta" <[email protected]> wrote:
    >
    Hello,
    I have successfully tested the Excel sample on WLS 7, and trying to run
    it on
    the WLS 8.1.
    Anyways, the common question for both is, how to access an excel files
    from different
    locations (e.g. c:\path\1.xls, \\domain1\finance\fin.xls, \\domain1\marketing\customer.xls,
    \\domain2\accounts\vouchers.xls)?
    From example i can see that it picks from a specific path under repository.
    Thanks
    Ashok Gupta

  • Copy file from a location to another

    I work on a Java process that must be optimized and I have some questions.
    This process includes a part of copying a file from a location from another (to be more specific, all files that exist in a directory, to copy in another directory), wich technique is more efficient and quickly? To copy using FileInputStream/FileOutputStream in Java or using a java Runtime process that calls a copy command of the Operating System?

    I work on a Java process that must be optimized and I
    have some questions.
    This process includes a part of copying a file from a
    location from another (to be more specific, all files
    that exist in a directory, to copy in another
    directory), wich technique is more efficient and
    quickly? To copy using
    FileInputStream/FileOutputStream in Java or using a
    java Runtime process that calls a copy command of the
    Operating System?Neither. Use the FileChannels in the nio package if you can:
    /* Note:  Proper resource closing and exception handling is not done here */
    try {
            // Create channel on the source
            FileChannel srcChannel = new
            FileInputStream("srcFilename").getChannel();
            // Create channel on the destination
            FileChannel dstChannel = new
            FileOutputStream("dstFilename").getChannel();
            // Copy file contents from source to destination
            dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
            // Close the channels
            srcChannel.close();
            dstChannel.close();
        } catch (IOException e) {
        }Spawning a Runtime process is probably the least efficient way to do it.
    - N

  • Reading XML file from specific location&Storing xmldata into related tables

    I am new to xml.
    My requirement is,
    1) Get the xml file from specified location (C:\xmlfiles\ xmldata.xml)
    2)Convert xml data in clob data.
    3)store the data into related table.
    and vice-versa.
    What i did,
    a) I got the data from related tables and converted into xmlformat using SQLX
    b)converted this resultset into clob data and stored as xml file in specific location.
    It uses more then ten tables.
    All this help i got from AskTom site , thanks for that.
    Now i have to do vise-versa, i.e. i have to perform 1), 2), 3) steps........
    Please tell me proper steps to acheive it.
    Thanks in advance for giving your precious time to solve my issue.

    Have you read the"XMLDB FAQ" in this Forum?
    You could use stuff like:
    create or replace directory xmldir as C:\xmlfiles'
    declare
    xmldata xmltype;
    begin
    xmldata := xmltype(bfilename('XMLDIR','xmldata.xml'),nls_charset_id('AL32UTF8'));
      -- etc, etc your code --
      -- --> convert to clob by using for instance getclobval() function
      -- --> then insert the data in your relational table with CLOB column
      -- etc, etc your code --
    end;
    /

  • How can One sender communication channel pick two file from two location

    Hello
    I have a requirement that how can One sender communication channel pick two file from two location.Both the file has same name...How to configure the one receiver communication channel.i dont have any IR,no mapping..Please help me...

    >
    Soumitra Sinha wrote:
    > Hello Vijay
    > I already done the adapter specific message attribute.i am getting the file name properly.but that is nothing to do with my req.i am again clearing my problem:
    > i have two folder   folder a,folder b.Both has the same file credit0002. i have two destination folder i have one sender and one receiver channel.I dont have any IR.How one sender channel can  pick file from two location and how one receiver channel can put in two location.please help me..
    Ok now I get your requirement.
    you cant achieve this -  how one receiver channel can put in two location if you dont have a dynamic configuration defined i.e Adapter specific attributes.
    easy way - involve IR mapping
    else
    have a adapter module to define your dynamic configuration.
    Ref: /people/daniel.graversen/blog/2006/10/05/dynamic-configuration-in-adapter-modules & /people/michal.krawczyk2/blog/2006/10/09/xi-dynamic-configuration-in-adapter-modules--one-step-further
    Set the dynamic directory/file name etc for your receiver adapter.

  • Load some flat files from ftp location

    HI,
    I have requirement, i want to load the some flat files from ftp location. but problem is in that ftp location i have multiple files.i want to load flat files starts with file name with numeric. otherwise i have apart from these start with numeric files .
    i have remain 2 flat files with constant name. i need to load flat files starts with file name with numeric or i need to leave these 2 constant files then need to load remain start with numeric files. how to achive this in ssis for each loop container.

    See these two examples:
    http://microsoft-ssis.blogspot.com/2012/01/custom-ssis-component-foreach-ftp-file.html
    http://microsoft-ssis.blogspot.com/2011/08/foreach-ftp-file-enumerator.html
    Please mark the post as answered if it answers your question | My SSIS Blog:
    http://microsoft-ssis.blogspot.com |
    Twitter

  • How to delete a READ ONLY file from Directory

    Hi Friends,
    how to delete a READ ONLY file from Directory , file is in my system only.
    Please help me .
    note: its read only file.
    Thank you.
    Karthik.

    hI,
    try with this statement.
    delete dataset <datasetname>.
    this will definitely work.
    Regards,
    Nagaraj

  • Read file from directory, update contents of the each file

    hai,
    I could not understand how to debug the error i have now.
    target
    1- read the files from directory // i able ot do this part
    2- for each file
    for each file read the content & compare with the existing List & update the list // i able to do this part
    when i try to combine both parts , i got some following error
    run:
    E:\java\check\100130.ixf
    Error: children[i] (The system cannot find the file specified)
    BUILD SUCCESSFUL (total time: 2 seconds)
    i can see from the code that children[i] only gives the error when i use that in the second part of the code.
    can any one help me on this??
    Thanks
    Priyan
    the original code
    import java.io.BufferedReader;
    import java.io.DataInputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.InputStreamReader;
    import java.io.RandomAccessFile;
    import java.util.ArrayList;
    public class CompareList
         public static void main(String[] args){
             ArrayList a1 = new ArrayList();
             ArrayList a2 = new ArrayList();
             a1.add("1");
             a1.add("2");
             a1.add("3");
             a1.add("4");
             a1.add("5");
             a1.add("6");
             a1.add("7");
             a1.add("8");
             a1.add("9");
             a1.add("10");
             a1.add("11");
             a1.add("12");
             a1.add("13");
             a1.add("14");
             a1.add("15");
             a1.add("16");
             a1.add("17");
             a1.add("18");
             a1.add("19");
             a1.add("20");
             a1.add("21");
             a1.add("22");
             a1.add("23");
             a1.add("24");
             a1.add("25");
             a1.add("26");
             a1.add("27");
             a1.add("28");
             a1.add("29");
             a1.add("30");
             a1.add("31");
             a1.add("32");
             a1.add("33");
             a1.add("34");
             a1.add("35");
             a1.add("36");
             a1.add("37");
             a1.add("38");
             a1.add("39");
             a1.add("40");
             a1.add("41");
             a1.add("42");
             a1.add("43");
             a1.add("44");
             a1.add("45");
             a1.add("46");
             a1.add("47");
             a1.add("48");
             a1.add("49");
             a1.add("50");
             a1.add("51");
             a1.add("52");
              try{
                    File dir = new File("E:\\java\\check");
                    File[] children = dir.listFiles();
                    if (children == null) {
                          System.out.println("does not exist or is not a directory");
        else {
               for (int i = 0; i < children.length; i++) {
                       System.out.println( children);
    FileInputStream fstream = new FileInputStream("children[i]");
    DataInputStream in = new DataInputStream(fstream);
    BufferedReader br = new BufferedReader(new InputStreamReader(in));
    String strLine;
    while ((strLine = br.readLine()) != null)      {
    String line =strLine.substring(0,2);
    // Print the content on the console
    //System.out.println(line);
    a2.add(line);
    } // end of add list2
    if (a1.size() > a2.size())
    int k = 0;
    for (int l = 0; l < a2.size(); l++)
    if (!((String)a1.get(l)).equals((String)a2.get(l)))
    //System.out.println((String)a2.get(i));
    // System.out.println("dd");
    k = l;
    k++;
    for (int l = k; l < a1.size(); l++)
    System.out.println((String)a1.get(l));
    String str = "children[l]";
    File file = new File(str);
    RandomAccessFile rand = new RandomAccessFile(file,"rw");
    rand.seek(file.length()); //Seek to end of file
    rand.writeBytes((String)a1.get(i)); //Write end of file
    rand.writeBytes("., 0.");
    rand.writeBytes("\n");
    }// end of comparing and updating the list2
              in.close();
    catch (Exception e){//Catch exception if any
    System.err.println("Error: " + e.getMessage());

    thanks for the information.
    i tried, the error
    like this
    run:
    E:\java\check\100130.ixf
    java.lang.StringIndexOutOfBoundsException: String index out of range: 2
            at java.lang.String.substring(String.java:1935) 
            at CompareList.main(CompareList.java:84)
    BUILD SUCCESSFUL (total time: 0 seconds)this comes because in my code i used children[i] as string in the later part
        else {
               for (int i = 0; i < children.length; i++) {
                        System.out.println( children);
    FileInputStream fstream = new FileInputStream(children[i]);
    DataInputStream in = new DataInputStream(fstream);
    BufferedReader br = new BufferedReader(new InputStreamReader(in));
    String strLine;
    while ((strLine = br.readLine()) != null)      {
    String line =strLine.substring(0,2);
    a2.add(line);
    System.out.println(line);
    } // end of add list2
    if (a1.size() > a2.size())
    int k = 0;
    for (int l = 0; l < a2.size(); l++)
    if (!((String)a1.get(l)).equals((String)a2.get(l)))
    //System.out.println((String)a2.get(i));
    // System.out.println("dd");
    k = l;
    k++;
    for (int l = k; l < a1.size(); l++)
    System.out.println((String)a1.get(l));
    String str = "children[l]";
    File file = new File(str);
    RandomAccessFile rand = new RandomAccessFile(file,"rw");
    rand.seek(file.length()); //Seek to end of file
    rand.writeBytes((String)a1.get(i)); //Write end of file
    rand.writeBytes("., 0.");
    rand.writeBytes("\n");
    rand.close();
    }// end of comparing and updating the list2
              in.close();
    i stil could not figure out it yet. do u have any clue with this.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Unable to pick up the file from Receive Location

    BizTalk is  unable to pick up the files from receive location.
    My admin console is working so slow.
    It is showing the problem of snap-in as follows:
    I have checked all my receive location and its masking,it is working fine.
    Actually it is working fine in dev server(snap-in problem is not occuring in dev server ) but when I import MSI and binding in UAT server.
    It is not picking up the file from receive location.
    I want to know one more thing :if my message box database is not working fine,will it receive the files from receive location.
    Prakash

    For files not received by receive location. If the Receive Location is still enabled but files are not processed by Receive Location, then check whether the host instance  configured with your receive location is running. If the host instance is in
    running state, restart the host instance and try.
    Regarding the error in the admin console as shown in the image, people started to see this issue with admin console from BizTalk 2009 onwards. This happens in cases like you have done some activity with console and before its been refreshed it you do more
    activities like expanding the node you will see this error. Sometimes WMI is bit slowly to refresh your admin console screen. Just wait for few seconds untill the WMI screen is rendered completely. Ensure you have all the cumulative updates installed for your
    version of BizTalk and also ensure the service pack for your OS is updated.
    Obviously if message box is not working, files will not be received/processed. But if message box is not in healthy state this would affect all other application not just one and in-fact it would affect entire BizTalk not just Receive Locations.
    To start analysing this file not been processed by Receive Location, start with checking the host instance as mentioned.
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Copy File from One Location to Another Location through xcopy or any

    Hi,
    I Need to copy one file from one location to another location. That file need to save in C:\Windows\System32 folder
    I need to create one .bat file and i want apply that bat as a startup script through GPO.
    I tried through XCopy if i test in machine that is working. If i tried in other machine that is not working. becoz of some Credential issue
    I tried in the script by netuse command after that my script itself not working.
    SET username=XYZ\Administrator
    SET password=abcd
    @ECHO OFF
    cmd "cd C:\"
    net use "\\10.50.5.68\c$\Windows\System32" %password% /user:domain\%username%
    :copy
    Xcopy /S /I /E D:\DLL \\10.50.5.68\c$\Windows\System32 
    Regards, Hari Prasad.D

    You cannot do that in a startup script.  You do not need to do that in a startup script.
    To add files to the system use GP Preferences.
    On Window 7 and later only the Trussted Installer is allowed to add files. (That means only Microsoft.)
    No programs or users should ever alter files in the system area.
    ¯\_(ツ)_/¯

  • How to load jar files from remote location

    Hi all,
    I am trying to load jar files from remote server, from a servlet which is running on OC4j.
    For doing this,First I am getting ClassLoader by using ClassLoader.getSystemClassLoader() and then type casting it to URLClassLoader.
    But by doing it I am getting ClassCastException,because oc4j returns oracle.classloader.PolicyClassLoader instead of java.net.ClassLoader.
    Appreciate if anyone can tell me how to load remote jar files using oracle.classloader.PolicyClassLoader .
    Thanks
    Harish

    Hi,
    I suppose you know about this, but just in case.
    I have used jnpl to load jar files from remote location.
    Rowan

Maybe you are looking for

  • Firefox 23.0.1 crashes every time I try to access any Mozilla help page or forum, and sometimes on other pages Win 7 pro 64 bit

    Running Windows 7 Pro 64 bit and Firefox has crashed at least a couple dozen times today and nearly as many yesterday. I've tried all of the suggested "fixes", to no avail. I just tried the Windows compatibility tool mentioned in one of the forum pos

  • Decryption of Message after processing by File adapter

    Hi, Encrypted File> XI> Encrypted File I have to pick up an encrypted file, decrypt it and do the message transformations & business process associated wiht it and place it in another folder by encrypting the file again. How can i acheive this.? Rega

  • Max connections to a share folder

    Hi, I'm helping a developer that has encountered issues in one of his applications. He has a process that creates a lot of threads to a single shared folder in a Windows 2008 Standard R2 Server. When the application is being heavily used, he gets the

  • 2 mta in the same host

    hi, i'm trying to make some test with an antivirus. i have only one server i installed ims 5.2 (smtp at port 10026) with iDS 5.2 (port 389), and i installed another iMS in the same host but the smtp is at port 25, before i install the antivirus softw

  • Skipping Survey questions... Is it Possible?

    Say for instance you've created a survey with a short answer question, but you want to give the end user the ability to skip the short answer and continue to the next question w/out having to input any text. Is there an option/button you can add to t