Reading file structure and path from other local system share in jsp

Hi,
I have a requirement where I need to list all the file and folder structure from other shared folder from different path.
\\tempx\\test , here test is the folder thats shared on tempx folder. if I copy and paste the path "\\tempx\\test" in start->run it opens the file in window. Same could be achived in java with File. However it gives issues in jsp. Please help me to resolve the issue.
Thanks in advance.

I am using below code to access share folder in other system and display all the file & directores below the folder. This code works fine in java in windows system, however if I move this in jsp and to Unix box issue appears. Plese guide
import java.io.*;
import java.io.File;
import java.lang.*;
public class BCMRepo
     public static void main(String args[])
          try
               File fbcm = new File("\\\\tmp678\\test\\Common");     
               String strFilename = fbcm.getAbsolutePath();
               System.out.println("strFilename :"+strFilename);
               String strFile[] = fbcm.list();
               if(fbcm.isDirectory())
                         System.out.println("Is directory");
                         for (int i=0;i<strFile.length;i++)
                              System.out.println(strFile);     
               else
                         System.out.println("Is not directory");     
          catch(Exception e)
               System.out.println("Error :"+e);

Similar Messages

  • Get file name and path from  adf inputFile

    Hi,
    I use adf's inputFile component. I need to get the file name and filePath. Does anyone knows how to do that?
    Thanks in advance

    You may bind the value to an UploadedFile object and get the name from this object.
    You may use a valueChangeListener backin bean method or a managed bean.
    Here the code i just write for something similar. Note that i'm not able to test it because of a bug in 10.1.3.1 with inputFile and web.xml parameters. I still waiting for the patch.
    public void uploadedFile(ValueChangeEvent valueChangeEvent) throws IOException,
    Exception {
    final int BUFFER = 2048;
    byte data[] = new byte[BUFFER];
    int currentByte;
    String fileName;
    UploadedFile uploadedFile =
    (UploadedFile)valueChangeEvent.getNewValue();
    if (uploadedFile != null) {
    String mimeType = uploadedFile.getContentType();
    if (mimeType == "application/x-zip-compressed") {
    // get the uploaded file as a zip file
    ZipFile zipFile = new ZipFile(uploadedFile.getFilename());
    // verify the zip archive contains only one entry
    if (zipFile.size() != 1) {
    FacesContext context =
    FacesContext.getCurrentInstance();
    ResourceBundle errorMessage =
    ResourceBundle.getBundle(context.getApplication().getMessageBundle());
    Exception ZipFileContentException =
    new Exception(errorMessage.getString("error.fileUpload.zipFileContent.moreThanOneEntry").replace("{0}",
    String.valueOf(zipFile.size())));
    throw ZipFileContentException;
    // get the entries in the zip file even it is only one
    Enumeration zipFileEntries = zipFile.entries();
    // Process each entry
    while (zipFileEntries.hasMoreElements()) {
    // grab a zip file entry
    ZipEntry entry =
    (ZipEntry)zipFileEntries.nextElement();
    // check the entry is not a directory
    if (entry.isDirectory()) {
    Exception ZipFileContentException =
    new Exception(JSFUtils.getStringFromBundle("error.fileUpload.zipFileContent.isDirectoryInsteadFile"));
    throw ZipFileContentException;
    File destFile = new File(entry.getName());
    Magic magic = new Magic();
    // getMagicMatch accepts Files or byte[],
    // which is nice if you want to test streams
    MagicMatch match = magic.getMagicMatch(destFile, true);
    if (match.getMimeType() != "application/xml") {
    Exception ZipFileContentException =
    new Exception(JSFUtils.getStringFromBundle("error.fileUpload.isNotXMLFile").replace("{0}",
    match.getMimeType()));
    throw ZipFileContentException;
    //TODO get the repository directory from classification-param.xml
    BufferedInputStream is =
    new BufferedInputStream(zipFile.getInputStream(entry));
    FileOutputStream fos = new FileOutputStream(destFile);
    BufferedOutputStream dest =
    new BufferedOutputStream(fos, BUFFER);
    // read and write until last byte is encountered
    while ((currentByte = is.read(data, 0, BUFFER)) !=
    -1) {
    dest.write(data, 0, currentByte);
    dest.flush();
    dest.close();
    is.close();
    zipFile.close();
    } else if (mimeType == "application/xml") {
    String currentEntry = uploadedFile.getFilename();
    File destFile = new File(currentEntry);
    BufferedInputStream is =
    new BufferedInputStream(uploadedFile.getInputStream());
    FileOutputStream fos = new FileOutputStream(destFile);
    BufferedOutputStream dest =
    new BufferedOutputStream(fos, BUFFER);
    // read and write until last byte is encountered
    while ((currentByte = is.read(data, 0, BUFFER)) != -1) {
    dest.write(data, 0, currentByte);
    dest.flush();
    dest.close();
    is.close();
    } else {
    Exception ZipFileContentException =
    new Exception(JSFUtils.getStringFromBundle("error.fileUpload.isNotXMLFile").replace("{0}",
    mimeType));
    throw ZipFileContentException;
    }

  • Help with making files viewable and playable from other accounts on leopard

    i recently got an imac (20in 2.4) and i want to play music on my account that is on my dads acccount...i looked it up and it said to click file and then 'get info' then you can make it 'view' or 'view and read' i do that and it still doesnt work...it keeps saying i dont have enough access privleges. please help

    Where did you look this up? (link please)

  • Does LabView program behave differentl​y under Traditiona​l Chinese version from regular English version. The program reads in numbers and characters from input files.

    Does LabView program behave differently under Traditional Chinese version from regular English version. The program reads in numbers and characters from input files.

    Hope this helps,
    Ankita

  • IWeb file structure and naming system

    I am trying to publish my iWeb directly to my domain (www.jessewarren.net) using the FTP direct publish function. However, iWeb is applying an overly complex naming system.
    For example, its publishing not only the page names, but also the name of the Site in iWeb, after the original URL. Here's an example: http://jessewarren.net/testing/Site/Blank.html
    First, I need everything to be on the domain. Then, I only need the name of the individual pages to be published, not the Site Name itself. I already have a site name, and that's my domain.
    Any other advice on how to control file structure and naming in iWeb?

    This is not incorrect and it is the way iWeb publishes and has done ever since iWeb 06. When you publish from iWeb to a local folder, what you get is your Site folder with your site name and a separate index file.
    If you don't want your site name included, then what you need to do is rather than using the direct ftp from iWeb, select ftp to a local folder instead. Your site will then be published to your desktop. Then download either Cyberduck or Transmit for free - these are dedicated ftp programs. Then all you do is load just the contents of your site folder to your public_html folder on your server and your url will then be http://www.domain.com/pagename.html.
    Be aware though, that if you are loading like this, you are breaking iWeb site structure and RSS feed will not be available to you if you need to use it.
    If you want to continue to use the built in iWeb ftp, then you could try naming your site public_html and then leaving the directory blank and then uploading like this and because you have named your site public_html and are uploading to the same place, your public_html folder on your server will be replaced with your website, thus eliminating the site name.
    I have tried this method once myself with my own site and it does work, however, I still prefer to publish to a folder and then upload to my sever using Cyberduck.

  • Need help understanding Time Capsule file structure and how to get it back

    I have the original Time Capsule on which I backup both my Mac Pro and my wife’s Macbook. When Snow Leopard came out, I successfully used the ‘Restore from Time Machine’ feature on my Mac Pro so I know it has worked. However, my wife’s MacBook harddrive died the other day and I was trying to do the ‘Restore from Time Machine’ and all it would find was a backup from April (when I put her in a new larger drive). Time Machine would not find any backup files newer that April. She stated that she had seen the the Time Machine backup notices regularly and as recent as the day the haddrive died (Nov. 23) so I figured that I should have no problem. Here is what I have found in my trouble shooting and what leads to my questions below.
    This is the file structure I found: (note that our ID’s are ‘Denise’ and ‘John’)
    *Time Capsule* (the drive as listed in my Finder window sidebar under ‘shared’)
    >Folder called ‘Time Capsule’ (when logged in as either ‘Denise’ or ‘John’)
    >>Denise Sparsebundle
    >>>Backup of Denise’s iBook (mounted image)
    >>>>Folder called ‘Backups.backupdb’
    >>>>>Folder called ‘Denise’s iBook
    >>>>>>Single folder with old April backup (not the right files)
    >>John Sparsebundle
    >>>Backup of John’s Mac Pro (mounted image)
    >>>>Folder called ‘Backups.backupdb’
    >>>>>Folder called ‘John’s Mac Pro’
    >>>>>>Folders containing all my backup files
    >Folder Called ‘Denise’ (if logged as ‘Denise’)
    >>Denise’s Sparsebundle (a disk image)
    >>>Backup of Denise iBook (the mounted image. Name from old machine)
    >>>>Backups.Backupdb
    >>>>>Denise’s iBook (Contains the backup I need)
    >Folder Called ‘John’ (if logged in as ‘John’)
    >> (empty)
    For some reason, my wife’s backup files are stored within a folder located at the top level of the Time Capsule drive called ‘Denise’, however, mine are within a folder called ‘Time Capsule’ which is at the same level as the ‘Denise’ folder.
    For some reason, when trying to use Time Machine to recover, it bypasses the top level ‘Denise’ folder which contains the correct files and goes into the ‘Time Capsule’ folder and finds the outdated backup files.
    I would assume that both my backup files and my wife’s should be at the same level of the Time Capsule.
    I was eventually able to use Migration Assistant to recover the files after installing a fresh OS and mounting the correct Sparsebundle image.
    So, my question, how do I get this fixed so that if I have to recover a drive with Time Capsule, it will find the correct files.
    Sorry for the long post and thanks in advance for any help.

    John Ormsby wrote:
    What I was trying to determine is why different backups for one particular machine are located at different file structure levels on my Time Capsule and why the most resent one for that machine is at a different level that for my other machine. Also, what is the correct level that both machines backups should be at.
    well John, first can you clarify if you are on 10.4.8 as your profile suggests ? if so, i'm wondering how you can use TM at all because TM was introduced with Leo. if you're not on 10.4.8, please update your profile. if you could, please also indicate details of your machine such as available RAM, processor, etc.
    second, what OS is your wife's machine running ?
    third, i frankly don't know too much about TM's file structure or if there indeed is such a thing as the correct one. however, i do know that it is best to leave TM to do its thing (as long as it's working). FWIW, though off-topic, you may want to have a look at this read for further information.
    last but not least, i see TM backups to my TC only as a part of my backup strategy. the backbone of my strategy is to create bootable clone of my startup disk(s) using e.g. Carbon Copy Cloner on a regular basis. while TM is capable of doing a full system restore, i don't trust it as much as a working clone. i use TM to retrieve a file i accidentally trashed a week ago but you cannot boot from a TM backup if your startup disk goes belly up.
    If I have missed this information in either the FAQs or the Troubleshooting article, I would greatly appreciate being pointed to it .
    i expect you didn't miss anything and i'm sorry you didn't find any help there. perhaps if Pondini (author of the FAQ and troubleshooting user tips) reads this thread, you will get the necessary advice on the file structure and more besides.
    good luck to you !

  • File name and path should be passed as parameter

    hi all,
    i am writing a set of statements into the text file. But i have to pass the file name and also path as a user enterable parameter.
    please suggest me to proceed further.
    for ex: i am storing it as
    output:=text_io.fopen(c:abc\def\out.txt','w');
    right now i am giving like this and storing the data, but now i have to allow file name and path as user parameter.
    please suggest me.
    Thanks..

    Hi,
    for ex: i am storing it as
    output:=text_io.fopen(c:abc\def\out.txt','w');
    right now i am giving like this and storing the data, but now i have to allow file name and path as user parameter.
    please suggest me.Well, how hard can it be?
    You have to get those two parameters from your application into two variables, say "v_filename" and "v_pathname", and then create the file just the same way using the variables to construct the full path :
    output:=text_io.fopen(v_pathname || '\' || v_filename,'w');

  • File structure and hierarchy in Aperture.

    Hi, everyone.
    I am trying to import folders with images into Aperture and, much to my surprise, have found that this process is everyting but intuitive and straightforward.
    My library (outside of Aperture) is made up of folders each corresponding to a day and location. These folders are labeled using the data and location as part of their name.
    As I try to import these folders into Aperture I can't seem to import them into a single folder or project as sub-folders or sub-domains of that project. I have tried to create a project and them import the folders into it but Aperture won't import them into that project and doesn't allow me to drag and drop it either once it has been imported. I also tried to create albums and folders but haven't been successful.
    How does this file structure in Aperture work in terms of hierarchy ? It certainly isn't structured the way the Finder is or any other file system I have seen to date. Creating folders, organizing them and bringing any type of data into these folders should be a simple process but in Aperture it doesn't seem to be.
    Am I doing something wrong or is Aperture trying to re-invent the wheel ?
    Is there any tutorial I can watch or read on how to work with Aperture's file structure and import folders and folders into it ?
    Thank you in advance.

    Regarding your specific problem I suggest treating each existing dated folder of image files as a single Project in Aperture. In Aperture a Project is a specific time-based concept that may or may not jive with what you previously considered a project. For instance I may have in my mind that shooting all the highest peaks in every state is a "project," but that would be inappropriate as an Aperture Project. Instead each peak might be a Project, but the pix of all the peaks would be pointed to as an Album.
    The way I look at it conceptually:
    Aperture is a database (DB), and each image file lives in one Project.
    Albums are just collections of Pointers that point to individual image files living in one or more Projects. Since they just contain pointers, albums can be created or deleted at will without affecting image files. Very powerful. And Albums of pointers take up almost zero space, so they are fast and do not make the Library size grow.
    Keywords can be applied to every image separately or in batches. Keywords are hugely powerful and largely obviate the need for folders. Not that we should never use folders, just that we should use folders only when useful organizationally - - after first determining that using keywords and albums is not a better approach.
    As one example imagine the keyword "flowers."  Every image of a 100,000 images Library that has some flowers in it has the keyword flowers. Then say we want to put flowers in an ad, or as background for a show of some kind, or to print pix for a party, or even just to look for an image for some other reason. We can find every flower image in a 100k-image database in 2 seconds, and in another few seconds create an Album called "Flowers" that points to all of those individual images.
    Similarly all family pix can have a keyword "family" and all work pix can have a key word "work." Each individual pic may have any number of keywords. Such pic characteristics (work, family, flowers, etc.) should not be organized via folders.
    So by using keywords and albums we can have instant access to every image everywhere, very cool. And keywords and albums essentially take up no space in the database.
    Another approach is to use a folder "Family" for family pix, a folder "Flowers" for flowers pix and another folder "Work" for work pix. IMO such folders usage is a very poor approach to using an images database (probably stemming from old paper or film work practices). Note that one cannot put an image with family in a field of flowers at a work picnic in all three folders; but it is instant with keywords.
    HTH
    -Allen

  • Separating file name and path

    Hi,
    I need to separate the file name and path of the file which I am uploading from my BSP appl.I am using SO_SPLIT_FILNAME_PATH ,but it is not working because this fm identifies '\' only from GUI front end.
    How do I separate the file name and path in BSP ?
    Regards,
    Ananya

    Assuming that you are using File Upload tag for file upload:
    DATA: fileUpload TYPE REF TO CL_HTMLB_FILEUPLOAD.
    fileUpload ?= CL_HTMLB_MANAGER=>GET_DATA(
                           request = request
                           id      = 'myUpload'
                           name    = 'fileUpload' ).
    file_name      = fileUpload->file_name.
    file_mime_type = fileUpload->file_content_type.
    file_length    = fileUpload->file_length.
    file_content   = fileUpload->file_content.
    Data : filepath type string,
           filename type string,
           t1 type string.
    filepath = file_name .
    while filepath CA ''.
      split filepath at '' into t1 filename.
    endwhile.
    In my sample code above, filename attribute will contain the name of the file uploaded.
    Hope this solves the problem.
    Regards,
    Ravikiran.

  • Target Data File Name and Path

    Hi,
    I'm trying to deploy a mapping that writes data into a file, but I need to dynamically set the name and the directory where I want to write this file. The only workaround I found was manually change the pl/sql generated code and change the values in the FOPEN call with a parameter, but this is no what I really want to do. Does anyone know how to tell WB not to hardcode the file name and path?
    I really appreciate you time,
    thanks in advance,
    Matias

    Carla,
    Unfortunately our releases do not go that fast...
    What you could do as an intermediate solution (this is what I would do) is create your mapping and load into a staging table (this can happen in set-based mode so would be fast). In a post mapping process you manually write to the flat file by making the calls to FOPEN etc. by selecting from the staging table. The post mapping process can have an input parameter that you dynamically pass (i.e. via a mapping parameter) and set the file name.
    Mark.

  • Adding the file name and path to a document

    Is there a way to automatically generate the file name and path (i.e. 'P:\ARF530\BACKGROUND\diagram.ai') to a document without having to copy and paste from the explorer window?

    Hi,
    So to select the directory, in the WHNE-BUTTON-PRESSED trigger write,
         :<block_name>.<path_item_name> := GET_FILE_NAME(' ', NULL, NULL, 'Choose any directory.', OPEN_FILE, FALSE);
         IF SUBSTR(:<block_name>.<path_item_name>, LENGTH(:<block_name>.<path_item_name>)) != '/' AND SUBSTR(:<block_name>.<path_item_name>, LENGTH(:<block_name>.<path_item_name>)) != '\' THEN
              :<block_name>.<path_item_name> := :<block_name>.<path_item_name> || '\';
         END IF;and to open the file, write,
    DECLARE
      FT_File  TEXT_IO.FILE_TYPE;
    BEGIN
      IF SUBSTR(:<block_name>.<path_item_name>, LENGTH(:<block_name>.<path_item_name>)) = '/' OR SUBSTR(:<block_name>.<path_item_name>, LENGTH(:<block_name>.<path_item_name>)) = '\' OR :<block_name>.<path_item_name> IS NULL THEN
           MESSAGE('Please Enter file name before continue');
           MESSAGE('Please Enter file name before continue');
           RAISE FORM_TRIGGER_FAILURE;
      END IF;
      FT_File := TEXT_IO.FOPEN(:<block_name>.<path_item_name>, 'w');
    END;Regards,
    Manu.
    If my response or the response of another was helpful or Correct, please mark it accordingly

  • Question about pass file name and path to file write adapter

    I need to pass file name and path to file adapter for write. I got partial answers from thread Re: Get File name using File Adapter , but seems InboundHeader_msg or outboundHeader_msg only takes file name, how do I pass file directory?
    since I still have to specify file format (like xxx_%xx%.txt) in the file adapter wizard. Will this name conflict with what the name defined in InboundHeader_msg ?
    Similarly, how can I pass a file name and path to a file synchread adapter?
    Thanks,
    Message was edited by:
    user531689

    Just overwrite the filename in the WSDL file that was generated

  • How do I put the file name and path into either the header or the footer?

    I need to keep track of pdf documents as their names or locations sometimes change.  I need to show both file name and path, preferably in the header.  I would also like it to refresh automatically when I change, say, the file name, but that's not as essential as the basic function of showing the file name and path.

    You will need to do this with a text field and a Javascript that executes on open.

  • How to find PG.xml file name and path associated with a FUNCTION

    Hi,
    I am having a function:IRC_VIS_HOME_PAGE with Web HTML value as below:
    OA.jsp?akRegionCode=IRC_VIS_HOME_PAGE&akRegionApplicationId=800&OAPB=IRC_BRAND
    How to find PG.xml file name and path assoicated with above funtion.
    Thanks,
    ashok

    Ashok,
    Function IRC_VIS_HOME_PAGE will have 2 parameter defined for it which are OASF and OAHP where
    OASF=<SelectedFunctionName> - this tells the Framework to select this function in the given "Home Page" menu context.
    OAHP=<HomePageMenuName> - this is used ONLY with the OASF parameter, and it is used to establish the current menu context. It should point to a "Home Page" menu.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to print the report file name and path and the last mod date

    Good morning,
    I am trying to print on the footer of the report the report file name and path as well as the report last modification date.
    Anyone would know how I can do that? I have checked the doc but found nothing.
    Thks. Philippe.

    Did you ever determine how to print report name and report last mod date?
    Thanks

Maybe you are looking for

  • Unable to capture the D4OSESSION during LOAD testing??

    Hi, Summary: ---------- I am doing the performance testing of the 50 concurrent users using one of the third party load test tool.But that tool is not able to capture the opening workbook sessions. Detail ----------- Normally when I open a D4O sessio

  • ALV Tree using ABAP Objects

    Can anyone tell me how to Copy a node on an ALV Tree using context menu ?

  • Binding Data (xml) Successfully

    Hi .... This is definitely a newbie question ... assistance appreciated. I am having no problems getting data to preview properly, either using xml sample data or an ole connection to a database.   I am guessing that for distribution where the data "

  • I want to play two ipods from same pc.

    Hi I have two ipods one for myself the other for my wife on my pod I have 933 songs on it but when my wife ask could she have the same songs on her pod only 456 songs came up how can she have the same number of songs on her pod so we have the same..h

  • Sending Contract to backend

    Hi All, We are trying to figure out PROS N CONS of two different options that can be used to send a contract to backend (as a follow on doc from bidding engine app only). These are 1. Directly create a backend contract by using badis. 2. Create GOA i