Re: path of the file

Hi all,
how to know the path of the file which is application server.
thanks&regarsd,
younis

When looking at/for files on the application server(UNIX) using AL11 you are restricted to only certian directories. The following ABAP program displays all files/directories on the application server(UNIX).
Copy the below program and check it .... it will give you the list of fiels and directorys in you server .
*: Description:  Using internal System Call we gain access to UNIX. :
*:               The program uses the standard Unix command 'cat' to:
*:               browse the file                                    :
*:               The program lets you browse a file record of up to :
*:               500 chars wide.                                    :
REPORT ZBROWSEFILE MESSAGE-ID Z1
                   NO STANDARD PAGE HEADING
                   LINE-COUNT 65
                   LINE-SIZE  80.
DATA: BEGIN OF TABL OCCURS 0,
      LINE(560),
      END OF TABL.
DATA: PARCOM_LOC LIKE RS37A-LINE.
DATA: COLOR TYPE I.
DATA: COUNT(16) TYPE C.
Parameters.                                                       *
SELECTION-SCREEN SKIP 2.
  PARAMETERS: PARCOM LIKE RS37A-LINE.
Validering af parametre.                                          *
TOP-OF-PAGE.                                                      *
TOP-OF-PAGE.
  PERFORM WRITE_PAGE_HEADING.
INITIALIZATION.                                                   *
INITIALIZATION.
  PARCOM = '/usr/sap/trans/* '.
START-OF-SELECTION.                                               *
START-OF-SELECTION.
PERFORM MAKE_LOC.
  PERFORM COLLECT_DATA.
  PERFORM WRITE_FILE_CONTENT.
  PERFORM WRITE_NUMBER_OF_CONTENT.
FORM MAKE_LOC.                                                      *
FORM MAKE_LOC.
  CLEAR: PARCOM_LOC.
  PARCOM_LOC(4)    = 'cat '.
  PARCOM_LOC+4(245) = PARCOM.
ENDFORM.
FORM COLLECT_DATA.                                                  *
FORM COLLECT_DATA.
  REFRESH TABL.
  CALL 'SYSTEM' ID 'COMMAND' FIELD PARCOM_LOC
                ID 'TAB'     FIELD TABL-SYS.
ENDFORM.
FORM WRITE_FILE_CONTENT.                                          *
FORM WRITE_FILE_CONTENT.
The following data item needs to be renamed as the     "DEVK910117
special character used is no longer valid.             "DEVK910117
*DATA: LÆNGDE        LIKE SY-FDPOS.                      "DEVK910117
DATA: LAENGDE       LIKE SY-FDPOS.                      "DEVK910117
LOOP AT TABL.
  LÆNGDE = STRLEN( TABL-LINE ).                        "DEVK910117
    LAENGDE = STRLEN( TABL-LINE ).                       "DEVK910117
  IF LÆNGDE GE 0.                                      "DEVK910117
    IF LAENGDE GE 0.                                     "DEVK910117
       PERFORM COLORLINE USING '  0' TABL-LINE+0(69).
       PERFORM STREGER_3.
    ENDIF.
  IF LÆNGDE GE 70.                                     "DEVK910117
    IF LAENGDE GE 70.                                    "DEVK910117
       PERFORM COLORLINE USING ' 70' TABL-LINE+69(70).
       PERFORM STREGER_3.
    ENDIF.
  IF LÆNGDE GE 140.                                    "DEVK910117
    IF LAENGDE GE 140.                                   "DEVK910117
       PERFORM COLORLINE USING '140' TABL-LINE+139(70).
       PERFORM STREGER_3.
    ENDIF.
  IF LÆNGDE GE 210.                                    "DEVK910117
    IF LAENGDE GE 210.                                   "DEVK910117
       PERFORM COLORLINE USING '210' TABL-LINE+209(70).
       PERFORM STREGER_3.
    ENDIF.
  IF LÆNGDE GE 280.                                    "DEVK910117
    IF LAENGDE GE 280.                                   "DEVK910117
      PERFORM COLORLINE USING '280' TABL-LINE+279(70).
       PERFORM STREGER_3.
    ENDIF.
  IF LÆNGDE GE 350.                                    "DEVK910117
    IF LAENGDE GE 350.                                   "DEVK910117
       PERFORM COLORLINE USING '350' TABL-LINE+349(70).
       PERFORM STREGER_3.
    ENDIF.
  IF LÆNGDE GE 420.                                    "DEVK910117
    IF LAENGDE GE 420.                                   "DEVK910117
       PERFORM COLORLINE USING '420' TABL-LINE+419(70).
       PERFORM STREGER_3.
    ENDIF.
  IF LÆNGDE GE 490.                                    "DEVK910117
    IF LAENGDE GE 490.                                   "DEVK910117
       PERFORM COLORLINE USING '490' TABL-LINE+489(70).
       PERFORM STREGER_3.
    ENDIF.
  IF LÆNGDE GE 560.                                    "DEVK910117
    IF LAENGDE GE 560.                                   "DEVK910117
The following can only pass over at most one byte      "DEVK910117
because the table line length is only 560. An error    "DEVK910117
results on compilation because it is currently         "DEVK910117
trying to pass over something which does not exist.    "DEVK910117
It is better to pass over just the one byte than       "DEVK910117
nothing at all.                                        "DEVK910117
     PERFORM COLORLINE USING '560' TABL-LINE+559(70).  "DEVK910117
       PERFORM COLORLINE USING '560' TABL-LINE+559(01).  "DEVK910117
       PERFORM STREGER_3.
    ENDIF.
  ENDLOOP.
  WRITE:/1(80) SY-ULINE.
ENDFORM.
FORM WRITE_PAGE_HEADING.                                          *
FORM WRITE_PAGE_HEADING.
   WRITE:/1(80) SY-ULINE.
   PERFORM STREGER_2.
   FORMAT INTENSIFIED.
   WRITE: /2(79) SPACE       COLOR 1.
   WRITE:  2    SY-DATUM     COLOR 1.
   WRITE: 15    PARCOM(65)   COLOR 1.
   PERFORM STREGER_2.
   WRITE:/1(80) SY-ULINE.
   PERFORM STREGER_2.
   FORMAT INTENSIFIED.
   WRITE: /2(79) SPACE COLOR 3.
   WRITE:   2    'Offset' COLOR 3,
           10    '0........1........2........3........' COLOR 3,
           50    '4........5........6....+....' COLOR 3.
   PERFORM STREGER_3.
   FORMAT RESET.
   WRITE:/1(80) SY-ULINE.
ENDFORM.
FORM STREGER_2.                                                   *
FORM STREGER_2.
   PERFORM WRITE_VLINE USING ' '  1.
   PERFORM WRITE_VLINE USING ' '  80.
ENDFORM.
FORM STREGER_3.                                                   *
FORM STREGER_3.
   PERFORM WRITE_VLINE USING ' '  1.
   PERFORM WRITE_VLINE USING ' '  9.
   PERFORM WRITE_VLINE USING ' '  80.
ENDFORM.
WRITE_VLINE.                                                      *
FORM WRITE_VLINE USING MODE POS.
   IF MODE NE 'T'.
     FORMAT INTENSIFIED.
   ENDIF.
   POSITION POS.
   WRITE: SY-VLINE.
   IF MODE NE 'T'.
     FORMAT RESET.
   ENDIF.
ENDFORM.
FORM COLORLINE.                                                   *
FORM COLORLINE USING TEXT1 TEXT2.
   ON CHANGE OF SY-TABIX.
      COLOR = COLOR + 1.
      COLOR = COLOR MOD 2.
   ENDON.
   FORMAT RESET.
   IF COLOR = 1.
      WRITE: /2(79) SPACE COLOR 2.
      IF TEXT1 = '  0'.
         WRITE: 3 TEXT1 COLOR 2, 11 TEXT2 COLOR 2.
      ELSE.
         WRITE: 3 TEXT1 COLOR 2, 10 TEXT2 COLOR 2.
      ENDIF.
   ELSE.
      WRITE: /2(79) SPACE COLOR 4.
      IF TEXT1 = '  0'.
         WRITE: 3 TEXT1 COLOR 4, 11 TEXT2 COLOR 4.
      ELSE.
         WRITE: 3 TEXT1 COLOR 4, 10 TEXT2 COLOR 4.
      ENDIF.
   ENDIF.
ENDFORM.
FORM WRITE_NUMBER_OF_CONTENT.                                     *
FORM WRITE_NUMBER_OF_CONTENT.
   DESCRIBE TABLE TABL LINES COUNT.
   FORMAT RESET. CONDENSE COUNT.
   RESERVE 3 LINES.
   WRITE:/1(80) SY-ULINE.
   WRITE:/1(80) SY-ULINE.
   WRITE: /2(79) SPACE                         COLOR 2.
   WRITE: 2      'Number of records in file:'  COLOR 2,
          29     COUNT                         COLOR 2.
   PERFORM STREGER_2.
   WRITE:/1(80) SY-ULINE.
ENDFORM.
Regards,
Pavan

Similar Messages

  • Displaying the path of the file selected by a FileChooser in a TextField

    I'm just getting started with Swing. I developed a simple dialog box that has two text fields and two buttons. The objective is to open two files using those two buttons. I used FileChooser to select the files. Now, I want to display the path of the selected files in their corresponding TextFields. I use the following code to do that.
    final FileChooser fc1 = new FileChooser();
    final FileChooser fc2 = new FileChooser();
    final TextField tf1 = new TextField();
    final TextField tf2 = new TextField();
    private void button1ActionPerformed(ActionEvent evt)
                int returnVal1 = fc1.showOpenDialog(labelPhpFile);
                if (returnVal1 == JFileChooser.APPROVE_OPTION)
                    File file1 = fc1.getSelectedFile();
                    String fileName1 = file1.getName();               
                    String filePath1 = file1.getPath();
                    tf1.setText(filePath1);
    private void button2ActionPerformed(ActionEvent evt)
                int returnVal2 = fc2.showOpenDialog(labelPhpFile);
                if (returnVal2 == JFileChooser.APPROVE_OPTION)
                    File file2 = fc2.getSelectedFile();
                    String fileName2 = file2.getName();               
                    String filePath2 = file2.getPath();
                    tf2.setText(filePath2);
    }The above code works fine only for the first file. Mean the path of the file selected using fc1 is getting displayed in the tf1 TextField. But, the file selected using fc2 is not getting displayed tf2 TextField. Please help me.
    Thank you :)

    h1. The Ubiquitous Newbie Tips
    * DON'T SHOUT!!!
    * Homework dumps will be flamed mercilessly.
    * Have a quick scan through the [Forum FAQ's|http://wikis.sun.com/display/SunForums/Forums.sun.com+FAQ].
    h5. Ask a good question
    * Don't forget to actually ask a question. No, The subject line doesn't count.
    * Ask once
        - Don't Crosspost!
        - Two people answering one question independantly is a waste of there time.
    * Don't even talk to me until you've:
        (a) [googled it|http://www.google.com.au/] and
        (b) looked it up in [Sun's Java Tutorials|http://java.sun.com/docs/books/tutorial/] and
        (c) read the relevant section of the [API Docs|http://java.sun.com/javase/6/docs/api/index-files/index-1.html] and maybe even
        (d) referred to the JLS (for "advanced" questions).
    * [Good questions|http://www.catb.org/~esr/faqs/smart-questions.html#intro] get better Answers. It's a fact. Trust me on this one.
        - Lots of regulars on these forums simply don't read badly written questions. It's just too frustrating.
          - FFS spare us the SMS and L33t speak! Pull your pants up, and get a hair cut!
        - Often you discover your own mistake whilst forming a "Good question".
        - Many of the regulars on these forums will bend over backwards to help with a "Good question",
          especially to a nuggetty problem, because they're interested in the answer.
    * Improve your chances of getting laid tonight by writing an SSCCE
        - For you normal people, That's a: Short Self-Contained Compilable Example.
        - Short is sweet: No-one wants to wade through 5000 lines to find your syntax errors!
        - Often you discover your own mistake whilst writing an SSCCE.
        - Solving your own problem yields a sense of accomplishment ;-)
    h5. Formatting Matters
    * Post your code between a pair of {code} tags
        - That is: {code} ... your code goes here ... {code}
        - This makes your code easier to read by preserving whitespace and highlighting java syntax.
        - Copy&paste your source code directly from your editor. The forum editor basically sucks.
        - The forums tabwidth is 8, as per [the java coding conventions|http://java.sun.com/docs/codeconv/].
          - Indents will go jagged if your tabwidth!=8 and you've mixed tabs and spaces.
          - Lines longer than 80 characters should be wrapped.
          - Proper indentation illustrates program logic.
    * Post your error messages between a pair of {code} tags:
        - That is: {code} ... errors here ... {code}
        - To make it easier for us to find, Mark the erroneous line(s) in your source-code. For example:
            System.out.println("Your momma!); // <<<< ERROR 1
        - Note that error messages are rendered basically useless if the code has been
          modified AT ALL since the error message was produced.
        - Here's [How to read a stacktrace|http://www.0xcafefeed.com/2004/06/of-thread-dumps-and-stack-traces/].
    * The forum editor has a "Preview" pane. Use it.
        - If you're new around here you'll probably find the "Rich Text" view is easier to use.
        - WARNING: Swapping from "Plain Text" view to "Rich Text" scrambles the markup!
        - To see how a posted "special effect" is done, click reply then click the quote button.
    If you (the newbie) have covered these bases *you deserve, and can therefore expect, GOOD answers!*
    h1. The pledge!
    We the New To Java regulars do hereby pledge to refrain from flaming anybody, no matter how gumbyish the question, if the OP has demonstrably tried to cover these bases. The rest are fair game.

  • In IE, while saving a file it is taking the full path with the file name

    Hi,I am using Tomcat5.5. In one page of my website, there is code responsible for saving an image from the server to the client machine. whenever i am doing this Mozila the file is getting saved with desired name. But in IE it takes full path of the file in the server directory along with its name while being saved in the client machine.Below is the code responsible for this. Plz Help.
    DiskFileUpload fu = new DiskFileUpload();
            List fileItems = fu.parseRequest(request);
            Iterator itr = fileItems.iterator();
            while(itr.hasNext())
              FileItem fi = (FileItem)itr.next();
              //Check if not form field so as to only handle the file inputs
              //else condition handles the submit button input
              if(!fi.isFormField())
                if(fi.getFieldName().equals("FileImage"))
                    if(fi.getSize() < 300000)
                      if(fi.getSize()!=0)
                            java.util.Random rd = new java.util.Random();
                            int random = rd.nextInt(100000);
                            String img_code = random + "";
                                  if(fi.getContentType().equals("image/jpeg") || fi.getContentType().equals("image/pjpeg") || fi.getContentType().equals("image/gif") || fi.getContentType().equals("image/png") || fi.getContentType().equals("image/x-png") || fi.getContentType().equals("image/bmp") || fi.getContentType().equals("image/wmp") || fi.getContentType().equals("application/octet-stream") || fi.getContentType().equals("audio/wav") || fi.getContentType().equals("audio/x-wav") || fi.getContentType().equals("audio/AMR") || fi.getContentType().equals("audio/amr") || fi.getContentType().equals("audio/mpeg") || fi.getContentType().equals("audio/mp4a-latm") || fi.getContentType().equals("audio/x-realaudio") || fi.getContentType().equals("audio/x-pn-realaudio") || fi.getContentType().equals("audio/x-pn-realaudio-plugin") || fi.getContentType().equals("audio/midi") || fi.getContentType().equals("audio/mid") || fi.getContentType().equals("audio/x-midi") || fi.getContentType().equals("audio/x-mid") || fi.getContentType().equals("audio/x-tone-seq") || fi.getContentType().equals("audio/imelody")
                                       || fi.getContentType().equals("video/mp4v-es") || fi.getContentType().equals("video/mp4") || fi.getContentType().equals("video/3gp") || fi.getContentType().equals("video/3gpp") || fi.getContentType().equals("video/mpeg") || fi.getContentType().equals("video-h263-2000"))
                                   System.out.println("Content from FileItem :  "+fi.getContentType());
                              File tempfile = new File(fi.getName());
                                    String imageFile=tempfile.getName();
                                    out.println("imageFile:" +imageFile);     
                                   imageFile= imageFile.replace(':','_');
                                   imageFile=imageFile.replace('\\','_');
                                   imageFile= imageFile.replace('/','_');
                                   imageFile= imageFile.replace(' ','_');
                                   System.out.println(imageFile);
                                  out.println("imageFile:"+imageFile);     
                                   int extIndex=0;
                                   String ext="";
                                  extIndex = imageFile.lastIndexOf(".");
                                  ext = imageFile.substring(extIndex+1);
                                                   if( ext.toLowerCase().equals("jpg") || ext.toLowerCase().equals("jpeg") || ext.toLowerCase().equals("jpe") || ext.toLowerCase().equals("bmp") || ext.toLowerCase().equals("gif")|| ext.toLowerCase().equals("png") || ext.toLowerCase().equals("wbmp")
                                                      || ext.toLowerCase().equals("amr") || ext.toLowerCase().equals("mp3") || ext.toLowerCase().equals("mp2") || ext.toLowerCase().equals("mpga") || ext.toLowerCase().equals("wav") || ext.toLowerCase().equals("midi") || ext.toLowerCase().equals("mid") || ext.toLowerCase().equals("kar") || ext.toLowerCase().equals("ra") || ext.toLowerCase().equals("ram") || ext.toLowerCase().equals("rm") || ext.toLowerCase().equals("au")
                                                      ||  ext.toLowerCase().equals("3gpp") || ext.toLowerCase().equals("3gp") || ext.toLowerCase().equals("mpeg") || ext.toLowerCase().equals("mpe") || ext.toLowerCase().equals("mpg") || ext.toLowerCase().equals("mp4") || ext.toLowerCase().equals("movie") || ext.toLowerCase().equals("avi") || ext.toLowerCase().equals("qt") || ext.toLowerCase().equals("mov") || ext.toLowerCase().equals("viv") || ext.toLowerCase().equals("vivo"))
                              File fNew = new File(application.getRealPath("/userImages/"),img_code+"_"+imageFile);
    //                         ImagePath =  imagepath+img_code+"_"+tempfile.getName();
                             ImagePath =  imagepath+img_code+"_"+imageFile;
                                   System.out.println("Image PAth : "+ImagePath);
    //                          ImagePath =  fNew.getAbsolutePath();
                              //out.println(fNew.toString());
                              ImageName = fNew.getName();
                                    System.out.println("Image Name : "+ImageName);
                                    out.println("ImageName:" +ImageName);     
                              fi.write(fNew);
                                    else
                                           System.out.println("Invalid File Type : "+ext);
                                           Error = "1: Invalid File Type/Extension : "+ext;
                            else
                                Error = "2: File uploaded is not valid.";
                       System.out.println("Content from FileItem :  "+fi.getContentType());
                                System.out.println("invalid Content Type");
                         else
                                Error = "";
                    else
                       Error = "3: File uploaded is not valid. Make sure that the image size does not exceed 300KB";
                       System.out.println("File uploaded is not valid.");
              else
                   session.setAttribute(fi.getFieldName(),fi.getString());
    session.setAttribute("ImagePath",ImagePath);
    session.setAttribute("ImageName",ImageName);
    session.setAttribute("barcodepath",barcodepath);
    //Added by Mutharasu on 30/08/2005
    session.setAttribute("tagpath",tagpath);
    Title = (String) session.getAttribute("txtTitle");
    if(Title.length()==0)
      Error = " Please Enter KoolTag Title : ";
    Key = (String) session.getAttribute("txtKey");
    URL = (String) session.getAttribute("txtURL");
    System.out.println("Key: "+ Key +", URL:"+URL);
    System.out.println("trace 5");
    if (ImagePath.trim().length()==0 && ImageName.trim().length()==0) {
       if (Key==null && URL==null)
          throw new Exception("4: "+Error);
    }

    Hi Vigneshwara,
    Please reopen a new thread in
    ASP.NET Getting Started forum because I can't move it there.
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Function Module to find the Path of the file in the Application Server

    Hi All,
            Any function module available to find the path of the file stored in the application server. Please let me know.
    Thanks.

    Check this code:
      DATA: dl_file TYPE ibipparms-path.    " File name
      CONSTANTS: c_dir       TYPE  rlgrap-filename.
    * F4 filename for Application server
        CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
          EXPORTING
            directory        = c_dir
            filemask         = ' '
          IMPORTING
            serverfile       = dl_file
          EXCEPTIONS
            canceled_by_user = 1
            OTHERS           = 2.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Error while getting the file name'(006).
          EXIT.
        ELSE.
          p_file =  dl_file.
        ENDIF.
    Thanks & Regards,
    Siri.
    Message was edited by:
            Srilatha T

  • How to get the complete path of the file that is selected using FormFile

    i m working on struts..
    i hv used FormFile like
    <html:file property="xsdpath" value="Browse" />
    need to get the whole path that i will select using browse button
    for example d:\foldername\filename.java
    but FormFile Api has a method getFileName(); which returns the filename, for getting the absolute path wat has to be done.
    please reply bak soon
    thanks in advance

    here i use formfile <html:file> just to allow the
    user to select a xml file .
    so i need to get the whole path of the selectedfile
    to parse the xml file.No you dont.
    You would definitely benefit from further reading on
    file upload.
    <html:file> tag renders an HTML <input> element of
    type file.
    When a user uploads a file, this file is sent as a
    stream of data, which a program (jsp/servlet) on the
    server, reads and stores the data back in the form
    of a file on the server.
    Any server program that needs to parse the file,
    should do so on the file stored on the server.
    There's no point in knowing the absolute path of the
    file on the client machine. If a server program can
    parse a file on the client machine, why upload the
    file in first case ? Get the drift ?
    i also want to show my user the path he hadselected.
    If you have such a requirement, then yes.
    But it sounds weird to me. If you see my response
    above, you will realize that the server has a copy of
    the client's file uploaded and then parsed. What if
    the client has changed his file after upload ?
    cheers,
    ram.I also have a requirement to get the whole filepath of the file selected and place this information into a table. From FormFile I can only retreive the absolute filename
    Any suggestions would be helpful.
    Thanks, dam

  • How to the link/path of the file being uploaded

    Hi all,
    I am uploading a CSV file in apex3.2 and would like to store the actual path of the file into a custom table. I get the file name as F26222/my_filename.csv from the FILE BROWSE apex item. How can I capture the path also?
    Thanks in advance.
    Movva

    cmovva wrote:
    Hi all,
    I am uploading a CSV file in apex3.2 and would like to store the actual path of the file into a custom table. I get the file name as F26222/my_filename.csv from the FILE BROWSE apex item. How can I capture the path also?For security/privacy reasons recent versions of browsers by default do not send local file path information from File Browse items to the server, nor expose the file path in the control's JavaScript methods. Firefox, Safari and Chrome only provide the filename. IE6 & IE7 still yield the path in Windows format. IE8 and Opera have adopted an irritating approach of replacing the path with a wholly imaginary "C:\fakepath\"&mdash;and this monstrosity has sadly had to be enshrined in the HTML5 spec...
    Changing IE's security config setting “Include local directory path when uploading files” enables the path to be exposed in IE8, but unless you're working in an intranet environment where: IE is the only browser used; it's possible to make remote changes to this setting on every desktop; and this won't break/expose anything else, then trying to achieve this is pointless.
    For more information see:
    http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-March/018980.html
    http://blogs.msdn.com/ie/archive/2009/03/20/rtm-platform-changes.aspx
    http://developers.whatwg.org/number-state.html#file-upload-state
    Please search the forum thoroughly before posting: this is the umpteenth time I've provided this information. There's even another live thread on the same topic: +{thread:id=2316750}+

  • Get only the filename not the full path of the file.

    hi to all..
    how can i get only the filename of the file not the full path and to be placed on a textinput.?
    example:
    when i'browse the file and select sample.txt
    "C:\Users\user\Desktop\folders\sample.txt" this will be inputted on the textinput.
    however, what i want to have is when i'browse and select a file..
    textinput should only contain "sample".
    does anyone knows how to do it?

    Hi cyrus@adobe,
    How are you getting the full path of the file when you browse, I dont think for security reasons the Flash Player will aloow to do so. You can only get the file name not the full path of the file when you browse.
    Are you using Flex4..?? I am not sure whether this is possible in Flex4..However if you are getting full path and if you wanted to show only the filename then you can just use theString class split function to acehive this..
    var fullPath:String = "C:\Users\user\Desktop\folders\sample.txt";
        var splitPath:Array = fullPath.split("\");
        textInput.text = splitPath[splitPath.length-1];
    Thanks,
    Bhasker

  • How do i get the path of the file selected for opening in JFileChooser

    hi
    I need to get the path of the file selected for opening or saving in the JFileChooser dialog box.Is there any method available.if not how do i get that?
    Thanks and Regards
    Saminathan.

    don't know if its the best/only way, but you could use the getSelectedFile() method in JFileChooser which returns a file and then use the getAbsolutePath() file method

  • How to handle spaces in using path to the file

    Hi Friends,
    I am getting error "file not found" if I give path of the file that contains spaces in it. (eg. C:\Users\Sample Project\file.txt)
    If I give path that doesn't contain spaces (eg. C:\Users\Sample\file.txt) then it works fine without any error.
    Basically I am invoking one command at runtime (using "exec") in my java program that excepts path of the file as one parameter.
    I can't remove space by manipulating path - othewise that path will be different.
    How can I solve this issue?
    Thanks

    Works for me:
    import java.io.*;
    public class ProcessExample {
        public static void main(String[] args) throws IOException {
            if (args.length == 0) {
                Runtime r = Runtime.getRuntime();
                dump(r.exec("java ProcessExample foo \"bar baz\""));
            } else {
                for(String s : args) {
                    System.out.println(s);
        static void dump(Process p) throws IOException {
            BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
            for(String s; (s = r.readLine()) != null; ) {
                System.out.println("[" + s + "]");
    }But ejp's advice is even better.

  • FileReader + ftp path of the file

    Hello everybody.
    I am trying to open a file using the FileReader but unfortunatelly the file is on an FTP server.
    My problem is that when I pass the path of the file e.g.
    ftp://pavlos/zzz.txt
    as a parameter to the FileReader
    it changes it automatically to: ftp:\pavlos\zzz.txt
    and obviously it can not access it.
    Could anybody suggest something?
    Thanks a lot

    A FileReader is just to read from files, local or over a network drive, but not using another protocol like ftp.
    What you might want is to use a UrlConnection. See java.net.URL.openConection() and java.net.URLConnection.getInputStream(). You may then wrap a java.io.InputStreamReader to get a Reader interface, if required.

  • How to create search path for the file on the desktop..

    hello experts..
          I have used gui_upload module to upload the data from flatfile to the internal table, in that how can i create search path for the file selection in the selection screen, also please help me the code to update the ztable.
    thanks

    HI
      If iam not wrong you want to select a file from a location that you don't know so if this is ur problem then use the function module
    F4_FILENAME
    this FM helps to locate and select the desired file from the system.
    Sample code that you can check is
    How to get windows filename
    PARAMETERS: lv_file LIKE rlgrap-filename.
    Method 1
        CALL FUNCTION u2019KD_GET_FILENAME_ON_F4u2019
        EXPORTING
        MASK = u2019,.txt,.*u2019
        STATIC = u2019Xu2019
        CHANGING
        FILE_NAME = LV_FILE.
    Method 2
    CALL FUNCTION u2019F4_FILENAMEu2019
    EXPORTING
             program_name = syst-cprog
             dynpro_number = syst-dynnr
             field_name  = u2019 u2019
         IMPORTING
             file_name   = LV_FILE.
    Regards
    Pavan

  • Is there any FM to separate the path from the file ?

    I have a file given by WS_FILENAME_GET. I want the path and the file in different fields. How can I split them?
    thank you

    hi,
    or use:
    data delimiter value '\'.
    split file at delimiter into table sptab.
    1) file = last entry
    loop at sptab.
    endloop.
    2) dir
    delete sptab.    "del file
    loop at sptab.
    concatenate string sptab delimiter into string.
    endloop.
    A.
    Message was edited by:
            Andreas Mann

  • Fileupload issue. Unable to get the full local directory path of the file uploaded

    Fileupload Applet Issue with Firefox 15:
    When uploading a file using our application, file that is being uploaded is hashed using a signed Applet.
    This is working fine in IE and FF version lower than FF15.
    Signed applet needs to hash file contents but it is is unable to read the full path of the uploaded file, and thus failing.
    Applet expects the full path of the file that has been uploaded
    Is there any way to get the full file path?

    Is not a new feature and not really a bug, but rather a security change that they have cleaned up code and removed the ability to use UniversalXPConnect that made it possible in older Firefox versions to get enhanced privileges.<br />
    That is no longer possible, so any code that relies on it will fail silently.<br />
    You will now require an extension to run any code that requires enhanced XPCOM permissions.

  • File browse : How to keep the file path in the file browse field?

    Hello,
    I have
    1) file browse field called P2_FILE_PATH.
    2) a select list with submit : P2_REGION
    If i upload some file d:\abc.gif , then select some region in the P2_REGION,
    P2_FILE_PATH will become empty. But in the session, i can find the blob value. but not the "d:\abc.gif "
    Using the following script I could capture the value of P2_FILE_PATH in a field
    P2_TEST.
    onload="javascript:document.getElementById(P2_FILE_PATH').value = document.getElementById('P2_TEST').value;"
    P2_TEST contains d:\abc.gif .
    How to retain the file path, though some other field is selected and submitted?
    Thanks in advance.
    Regards,
    Archana

    Hello Archana,
    You can't do what you want because of some HTML security restrictions – nothing to do with APEX. As you found out, You can capture the value of this item. You can't set it. After submitting the page, the browser is the one to clear the item.
    The only workaround is to work with AJAX and not submit the page until the end of the user input phase.
    Regards,
    Arie.

  • How to find the path of the file at enduser system

    Hi  Frndz..
    Am per my requirement i need to read XL file from enduser PC, for this i need to kno the path on the enduser PC i.e . ,lets assume that test.xsl file is there an enduser PC on his desktop , so i need the path where its like  "C:\Docsandsettings\desktop\test.xsl"..
    Plz suggest me
    Regards
    Rajesh

    Hi,
    You have to first upload this file using fileupload UI element.
    Then you can do the rest.
    Following tutorial will explain you it in detail
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00062266-3aa9-2910-d485-f1088c3a4d71
    Regards
    Ayyapparaj

Maybe you are looking for

  • All Background Jobs Are cancelled

    Hi all, I make a new server by restoreing backup of our production server and SAP is running well.But when I schedule any back ground jobs all jobs are cancelled.Due to this I am not able to run SGEN.Even when I manually schedule any back ground jobs

  • RE: Getting ORA-01003: no statement parsed error

    Hi, It looks familiar to some of the error which I encountered before. The situation was a for ... select loop without explicit begin/end transaction. The reason given by Forte consultant is that: The dbsession used by the for ... select loop needed

  • TOC links in Book?

    You guys were so quick on the draw with my last question (Thank You!) I figured I'd give this a shot. I've been building my PDFs as "interactive" for some time now so I was surprised to find most of the links in my book's (.indb) TOC do not work. The

  • Table Statistics failed during Import

    Hi All, I am trying to import an existing schema in Oracle 10g. I am using the impdp utility. The export dump consists of the complete schema (metadata and data). But it failed with the following logs. Processing object type SCHEMA_EXPORT/TABLE/STATI

  • Slideshows on HD TV's

    I am using DVDSP to make slideshows. When I am in the Simulate mode of DVDSP, I can switch from SD to HD720, and to HD 1080. When I go to the HD modes, the picture gets burry. How can I made Standard DVD's using my slideshows from DVDSP that will not