Delete html file from server

Hi,
I need to create a html file on a websphere server and after I work with it I need to delete the html file. I can create this file but when I'm trying to delete the it, doesn't work. If this file is not a html file it works, why?
I know, the solution could be, not to create a html file, but I need a file with htm/html extension. Does anybody know how I can solve my problem?
Thanks in advance.
Cris

hi,
try this code..
test1.jsp --->
<% java.io.FileOutputStream fo = new java.io.FileOutputStream(getServletConfig().getServletContext().getRealPath("/")+"\\test.html");
fo.close();
fo = null;
System.gc();
%>
<%!
     public void finalize(){
          System.out.println("Deleted!!");
test2.jsp --->
<%
java.io.File file = new java.io.File(getServletConfig().getServletContext().getRealPath("/")+"\\test.html") ;
file.delete();
file = null;
System.gc();
%>
<%!
     public void finalize(){
          System.out.println("Deleted!!");
%>
and tell me , you know anything more..
( I could think of only closing of the file, other wise , the file was not deleting untill the Garbage collector was called on the servelt)
Once the garbage collector runs and destroyes your servlet , then in the
subsequent request (code with delete) used to work..
If you know more .. Let me know
with Regards
Lokesh T.C

Similar Messages

  • How to delete the files from server through OAF page

    Hi All,
    I have a requirement in which i am creating files on server through my CO code.
    Now once the page is rendered, i want to delete the files from the server.
    Just wondering how can we achieve this.
    Kindly advice!
    Thanks,
    Sachin

    Hi Sachin
    all the methods in the processRequest() are called during loading of the page.
    all the methods in the processFormRequest() are called during any action events on the page.
    So Use the method in processFormRequest() : write a method in
    that on which action you want to delete the file.
    regards
    sridhar

  • Delete CSV file from server using php

    Hi all,
    I've got a link in a site I'm creating that I would like to trigger php to delete a CSV file that is held on the server.
    Any one have any ideas?
    Cheers
    T

    http://www.php.net/manual/en/function.unlink.php
    http://www.php.net/manual/en/ref.filesystem.php - More file functions.

  • System exception while deleting the file from app server in background job

    Hi All,
    I have a issue while the deleting the file from application server.
    I am using the statement DELETE DATASET in my program to delete the file from app server.
    I am able to delete the file from the app server when i run the program from app server.
    When i run the same report from background job i am getting the message called System exception.
    Is there any secuirity which i need to get the issue.
    Thank You,
    Taragini

    Hi All,
    I get all the authorization sto delete the file from application serever.
    Thing is i am able to run the program sucessfully in foreground but not in the background .
    It i snot giving any short dump also just JOB is cancelled with the exception 'Job cancelled after system exception ERROR_MESSAGE'.
    Can anybody please give me suggestion
    Thanks,
    Taragini

  • Help needed - OS Command foe deleting a file from Appplication server.

    Hi,
    I have requirement, where in i need to delete a file from the application server. It has to be done automatically. I thought of using OS Command for achieving the same. Can anyone help me in achieving it. The OS of my application server system is UNIX.
    Thanks in advance!!
    P.S: Points will be rewarded.

    Hello Sudeep,
    If you define the command for each operating system using transactions SM69 (You can test it with SM49) and then call it using SXPG_COMMAND_EXECUTE which contains a parameter defining the operating system (SY-OPSYS)
    then it does not matter which operating system is running, the function module always calls the correct version of the command.
    So, for example you could define a command 'OS_COMMAND'
    which deleted a file. This would have one version for Dos
    which said 'del', and a second version for unix which said 'rm'.
    The correct command would be specified by the call to SXPG_COMMAND_EXECUTE because the operating system parameter differentiates between the two commands.
    [USING PROCESS CHAINS IN SAP BW|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e0a7cd90-0201-0010-49a1-d730a56895f4]
    SXPG_COMMAND_LIST_GET – Reads a list of external OS commands
    Thanks
    Chandran

  • How to delete a file from Appliction Server.

    Hi Gurus,
    I want to delete a file from application server .
    can any one tell me the FM/BAPI.
    Plz Reply me ASAP.
    Thanks in Advance.

    BAPI_DOCUMENT_DELETE ?
    GUI_DELETE_FILE ?
    maybe just go to SE37, enter DELETE, and click on the document icon to find from repository system.
    Regards,
    Vincent

  • How to delete a file from application server?

    Hi gurus,
    i want delete a file from application server . can any one tell me the BAPI/Fm .
    thanks in advance

    See the replies of the thread;
    How to delete  File from the Application Server,ABAP
    But i can smell something fishy in both  The specified item was not found. and The specified item was not found. style of posting questions. Also both of you have similar questions in your profile....
    Hmmm, Mods have to take care of the Rest...
    Regards
    Karthik D

  • Delete WorkBook and Query file from Server .

    Dear All Experts .
    I dun know i posted in correct places or not .. (correct me if i m wrong) .. i want to ask about the BW Workbook and query.
    How we going to remove the remove the workbook or query files from Server ? bc i tried to delete from Analyzer(excel 2007), the file is deleted from the view , but havent delete from the server... So how i going to remove the file from server ?
    Thank.

    Hello I have the same problem. Can you please tell me how you finaly manage to delete the workbook.
    thank's you for advance,
    Akiba

  • Can ODI delete a file from an FTP server

    Hi
    I'm downloading a file via FTP - but I want that file removed after it's downloaded.
    So I want to 'move' the file down, rather than copy it... or delete it after it has downloaded
    Is this possible with ODI?
    Many thanks
    Z.

    Have a read of :-
    Re: Is this possible?
    Re: Delete multiple files from FTP Folder
    Ok?
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • How to make html file on server side from the data entered in text area

    Hi!
    I want to know how to make .html file on server side. Like if i enter the data in text area ( or like we normaly see when we write mail that editor) and we can use html tages in it and when user submit form all the data in that field will be saved on server side as an html formate. Is it possible to do so??? or any ruff idea how to design it???

    Erm ...
    Whats the problem with that?!
    Ok, here the code ...
    String myparameter = request.getParameter("paramname");
    String htmltemplate = "<html>\n"
                         +"<head><title>demo</title></head>\n";
                         +"<body>@parametertag@</body>\n";
                         +"<html>";
    String htmlpage = htmltemplate.replaceAll("@parametertag@",myparameter);
    File yourHTMLfile = new File("wheredoyouwannagotoday.html");
    FileOutputStream fos = new FileOutputStream(yourHTMLfile);
    fos.write(htmlpage.getBytes());
    fos.close();You're done.
    Happy Coding! :-) &copy;

  • How to delete a  file from AL11??????

    Hi Friends,
    how can i delete a file from AL11 directory....
    i have found FM's like EPS_DELETE_FILE, EDI_PORT_DELETE_FILE and some more from SAP system but those are not deleting the files....
    let me know if i can write a program for this and if yes then guide me for writing the same....
    Thanks,
    Nagesh.

    reference:http://saplab.blogspot.com/2007/10/sample-abap-program-to-delete-file-from.html
    REPORT ZDELETE.
    Delete a file on the application server.
    PARAMETERS: P_DIR LIKE RLGRAP-FILENAME
    DEFAULT '/usr/sap/trans/', *it will delete files from this dir
    P_FILE1 LIKE RLGRAP-FILENAME.
    DATA: P_FILE(128).
    DATA: W_ANS.
    START-OF-SELECTION.
    CONCATENATE P_DIR P_FILE1 INTO P_FILE.
    check file exists
    OPEN DATASET P_FILE FOR INPUT.
    IF SY-SUBRC NE 0.
    MESSAGE E899(BD) WITH P_FILE 'does not exist'.
    EXIT.
    ELSE.
    CALL FUNCTION 'POPUP_CONTINUE_YES_NO'
    EXPORTING
    DEFAULTOPTION = 'N'
    TEXTLINE1 = P_DIR
    TEXTLINE2 = P_FILE1
    TITEL = 'ARE YOU SURE YOU WANT TO DELETE'
    START_COLUMN = 25
    START_ROW = 6
    IMPORTING
    ANSWER = W_ANS
    EXCEPTIONS
    OTHERS = 1.
    ENDIF.
    CLOSE DATASET P_FILE.
    CHECK W_ANS = 'J'.
    delete
    DELETE DATASET P_FILE.
    IF SY-SUBRC NE 0.
    MESSAGE E899(BD) WITH 'Invalid file name' P_FILE.
    ELSE.
    CLOSE DATASET P_FILE.
    MESSAGE I899(BD) WITH P_DIR P_FILE1 'DELETED'.
    ENDIF

  • I want to save a html file to server and then want to open it.

    Requirement: I'm having an applet which is having a button named letter. When a user clicks on the button, following should happen --> An event will occur which will read some data from backend system(mainframe) and will store that in a string variable. A html file is created using this data in the body part, and then it should open in a browser.
    My problem is how can I launch(open in a browser) this html file.
    1) Is it possible to launch this file without storing it on hard drive.
    2)To use Runtime.getRuntime.exec(cmd.exe /c start filepath) , I need to store this file somewhere. How can i store this on server?

    1) Can you please give me an example showing how i can use Jtextpane.For html, JEditorPane (instead of JTextPane is better)
    For examples, go through these tutorial trails:
    [http://java.sun.com/docs/books/tutorial/uiswing/components/editorpane.html]
    [http://java.sun.com/docs/books/tutorial/uiswing/components/text.html]
    2)Also please tell me how to save the file on user's machineSee this trail:
    [http://java.sun.com/docs/books/tutorial/essential/io/index.html]
    and how can i delete the file from user's machine once it is closed by the user?Very simple, read the api docs: [http://java.sun.com/javase/6/docs/api/java/io/File.html#delete()]
    Thanks!

  • List the files from server

    Hi Experts,
      I have a requirement in my application, that list out the files from the server in table and also delete the file. Pls specify the code.
    Regards,
    Kiruba.R

    Hi
    List all the files from server
    public void listServerFiles( )
        //@@begin listServerFiles()
        wdContext.nodeFiles().invalidate();
        IPrivateExperimentView.IFilesElement element;
        java.io.File file = new java.io.File( "D:\\Test");
        File list[] = file.listFiles();
        for( int i = 0; i < list.length; i++)
             element = wdContext.createFilesElement();
                  element.setFileName( list[ i].getName());
             wdContext.nodeFiles().addElement( element);
        //@@end
    Display the selected file
    public void onActiondownload(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActiondownload(ServerEvent)
        IWDResource resource;
        String name = wdContext.currentFilesElement().getFileName();
        String path = "D:\\Test\\" + name;
         InputStream stream;
         try {
              stream = new FileInputStream(path);
              resource = WDResourceFactory.createResource( stream, name,
                                  WDWebResourceType.UNKNOWN, true);
              stream.close();
              wdComponentAPI.getWindowManager()
                             .createNonModalExternalWindow( resource.getUrl( 0), name).show();
         } catch (FileNotFoundException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
         } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
    Delete the selected file
    public void onActiondeleteFile(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActiondeleteFile(ServerEvent)
        String path = "D:\\Test\\" + wdContext.currentFilesElement().getFileName();
        File file = new File( path);
        file.delete();
        listServerFiles();
        //@@end
    vinod

  • How to download a file from server machine to client machine using jsp

    Hi,
    In my application, I have an excel file stored on my server machine. How can I download that excel file on to my client machine using jsp. Is there any other way I can open that file from my machine and save it in my machine using jsp/java?
    Its an emergency for me to do this.
    Can anyone provide me the full code to download a file from server machine as I don't have
    time to browse through various sites.
    thanks in advance,
    Tiijnar

    Please post your code using code tags (click on CODE above the text area, when posting)
    response.setContentType("application/octet-stream");Why octet-stream? Set the correct mime-type.
    String disHeader = "Attachment; Filename=\"filename\"";The filename should just be the file's name. Not the complete path to the file! This will tell anyone where the file is located on the server. It's also inconvenient because by default,the browser will suggest it as the name for the download.
    Your way of writing to the output stream is just plain wrong. See this snippet (picked from [http://balusc.blogspot.com/2007/07/fileservlet.html])
            BufferedInputStream input = null;
            BufferedOutputStream output = null;
            try {
                // Open streams.
                input = new BufferedInputStream(new FileInputStream(file), DEFAULT_BUFFER_SIZE);
                output = new BufferedOutputStream(response.getOutputStream(), DEFAULT_BUFFER_SIZE);
                // Write file contents to response.
                byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
                int length;
                while ((length = input.read(buffer)) > 0) {
                    output.write(buffer, 0, length);
                // Finalize task.
                output.flush();
            } finally {
                // Gently close streams.
                close(output);
                close(input);
            }

  • ITunes deletes song files from my computer when I sync a device

    When I sync a device in iTunes, it will sync fine and copy over all the files I need it to, but sometimes it will delete those files from my computer after it finishes copying them over. I'm not sure why this happens, I just know that I definitely have the songs on my machine before the sync, and afterwards, exclamation marks will begin appearing next to some of the items that were just synced over. It isn't a problem with the music files themselves, because it might only delete a few songs from an album that I imported all at the same time. It isn't just one device either, it's happened with all of my devices: an iPod Shuffle 2nd and 4th gen, Nano 5th and 6th gen, Classic, iTouch, and iPhone 3GS and 4GS. I've set iTunes to automatically copy music files into the iTunes media folder, and keep it organized, so I try navigating to the folder where the files would be, and the files are just not there anymore, or anywhere in the media folder; there's nothing in the reclycling bin either. The lower bit rate music file will be on the device still, but that's the only copy to be found anywhere. I have a fairly large iTunes library - about 90 GBs of music, and over 100 GBs of Movies and TV shows - but I'm not sure if that's part of the problem or not, though it does slow down iTunes a great deal when editing file info. I only know that it happens with music files, since I don't really sync over the other types of media as much. I believe that it might have something to do with the 'Convert higher bit-rate songs to ___ kbps' function, because it appears that only files that are higher bit rates than that setting will be deleted.
    I've tried dealing with it for awhile, but it's getting to be a real pain to go find and re-import all of those CDs, so I'm hoping someone can help me with why it happens or at least a way to stop the deletions. Maybe someone else is having this same problem as well?

    Hi Waltpa,
    Welcome to Adobe Forum,
    Have you referred to :
    http://forums.adobe.com/message/5353903
    http://forums.adobe.com/thread/1271663
    http://forums.adobe.com/message/6183619
    http://forums.adobe.com/message/6180892
    http://helpx.adobe.com/creative-cloud/help/sync-files.html
    They contain good information, it might help you.
    Regards,
    Rajshree

Maybe you are looking for

  • Help with home network.

    Not sure if this is the proper forum for this question, just point me in the right direction if I'm wrong. I am a new student in networking, taking the CCNA courses, and now want to rewire my home.  I currently have a cable modem and E2500 setup runn

  • MacBook Pro port icons disappearing from Unibody...

    Hi, I was wondering if the following issue is normal. I have a mid 2010 MacBook Pro and today I looked at the ports of the computer and noticed that both the icons that indetify the ethernet and magsafe ports are fading away.  Most of the time the Ma

  • Calendar questions/trouble...

    I will admit I do not know much about my iPhone accept to IM, make phone calls, and listen to tunes; just the basics in communication.  I am wanting to use the calendar functions, however, I do not care for the default calendar that comes with the ph

  • I have a MacBookPro, Mac OS X 10.6.7 - just had something called mountos.hfsguyFU' what is this?  I am not on network.

    I have a MacBookPro, Mac OS X 10.6.7 - just had something called mountos.hfsguyFU' what is this?  And what program/s would run this. I am not on any type of network. I have a wireless modem all password protected as well as my Powerbook.   I have all

  • Extracting data from tables

    hi friends, i need to extract complete material master data from 4.7 and upload to ecc 6.0. to extract the material master data, which is the best way, how do i do that is query a good way of extracting this data, are there any disadvantages. thanks