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.

Similar Messages

  • Reading a CSV file from server

    Hi All,
    I am reading a CSV file from server and my internal table has only one field with lenght 200. In the input CSV file there are more than one column and while splitting the file my internal table should have same number of rows as columns of the input record.
    But when i do that the last field in the internal table is appened with #.
    Can somebody tell me the solution for this.
    U can see the my code below.
    data: begin of itab_infile occurs 0,
             input(3000),
          end of itab_infile.
    data: begin of itab_rec occurs 0,
             record(200),
          end of itab_rec.
    data: c_comma(1) value ',',
            open dataset f_name1 for input in text mode encoding default.
            if sy-subrc <> 0.
              write: /, 'FILE NOT FOUND'.
              exit.
            endif.
    do
      read dataset p_ipath into waf_infile.
      split itab_infile-input at c_sep into table itab_rec.
    enddo.
    Thanks in advance.
    Sunil

    Sunil,
    You go not mention the platform on which the CSV file was created and the platform on which it is read.
    A common problem with CSV files created on MS/Windows platforms and read on unix is the end-of-record (EOR) characters.
    MS/Windows usings <CR><LF> as the EOR
    Unix using either <CR> or <LF>
    If on unix open the file using vi in a telnet session to confirm the EOR type.
    The fix options.
    1) Before opening the opening the file in your ABAP program run the unix command dos2unix.
    2) Transfer the file from the MS/Windows platform to unix using FTP using ascii not bin.  This does the dos2unix conversion on the fly.
    3) Install SAMBA and share the load directory to the windows platforms.  SAMBA also handles the dos2unix and unix2dos conversions on the fly.
    Hope this helps
    David Cooper

  • Cannot Delete CPTL file from Desktop using Vista

    Hi All,
    I cannot Delete CPTL file from Desktop using Vista. Explorer
    crashes. It is a Captivate 2 file.
    I have tried (with no luck):
    - logging in as a different user and deleting the file.
    - running explorer as an Administrator
    - uninstalling Captivate.
    Anyone got any ideas?
    Cheers,
    Raef

    Hi Raef,
    That is a strange issue. Here are a couple more ideas you
    could try:
    - Have you tried renaming the file (including suffix)?
    - Have you rebooted?
    - Do you get any error messages when trying to delete, such
    as "Acess Denied"?
    - Is your machine networked? Is it possible someone else has
    the file open?
    - Can the file be moved to another location or put in a
    folder (and then deleted)?
    - Have you tried using the Command Prompt / DOS mode to
    delete the file?
    It sounds like it could be a Vista issue so I would look at
    the Microsoft Vista forums too. Sorry I do not have an exact
    answer.
    IHTH,
    Aaron

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

  • How to delete a files from MNT using scripting in OSD

    Hi ,
    I am looking a method for deleting a set of files present in virtual drive(MNT).
    Please let me know scripting methods that can achieve above things and i can add that in OSD FIle.
    Kindly advise
    Umeed4u

    Here's two basic options (this does not count as scripting):
    http://ss64.com/ps/remove-item.html
    http://ss64.com/nt/del.html
    Don't retire TechNet! -
    (Don't give up yet - 13,225+ strong and growing)

  • How to read file from server if I have a logical file path?

    Hi guys,
    I'm having a pretty "on the run" question,
    My program is currently reading a file from server using "open dataset" with file path like this (just example)
    /usr/interface/abc/bcd/testfile.dat
    Now I got a requirement to make it more consistent to read files, instead of reading that physical file name, I should read the files from a specific folder using logical path.
    So I go to T code "FILE" and created a logical path called ZABC_FILE_PATH, unix compatible, with physical path is (for example),
    /usr/interface/<sysid>/<client>/<filename>
    My question is, can I still use open dataset statement to read this? if yes, how do I do that? If no, there should be alternative way, please let me know what you think. Thanks,

    Thanks all, I figured it out.
    ONe thing is that typo double quote
    The other thing is the importing part, I need the full file path.
    CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
      EXPORTING
        CLIENT                           = SY-MANDT
        logical_path                     = 'ZABC_MY_LOGICAL_FILE_PATH'
    *   OPERATING_SYSTEM                 = SY-OPSYS
    *   PARAMETER_1                      = ' '
    *   PARAMETER_2                      = ' '
    *   PARAMETER_3                      = ' '
    *   USE_BUFFER                       = ' '
        file_name                        =  v_1
    *   USE_PRESENTATION_SERVER          = ' '
    *   ELEMINATE_BLANKS                 = 'X'
      IMPORTING
        FILE_NAME_WITH_PATH              = v_what_I_need
    * EXCEPTIONS
    *   PATH_NOT_FOUND                   = 1
    *   MISSING_PARAMETER                = 2
    *   OPERATING_SYSTEM_NOT_FOUND       = 3
    *   FILE_SYSTEM_NOT_FOUND            = 4
    *   OTHERS                           = 5
    I really appreciate your contributions, thanks again!

  • Delete a .csv file from desktop system

    Hi All,
    My requirement is to read the .csv file from the desktop system having the shared folder and delete the file after read successfully.
    Here I can read the .csv file from the location using the function RFC_REMOTE_FILE and updated the content into internal table.
    But I cant delete the file from the presentation server ( Desktop system).
    Can anyone tell me how to delete the .csv file from the desktop system on different location.
    Note:
    I followed this link to read file:
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/9831750a-0801-0010-1d9e-f8c64efb2bd2&overridelayout=true

    Hi Rob,
    Thanks. I solved this problem myself.
    The solution to delete the file from remote system is
    concatenate 'DEL' i_filename i_dirname into v_bkfile separated by space .
    call function 'RFC_REMOTE_EXEC'
      destination  c_dest
      exporting
        command               = v_bkfile
      exceptions
        system_failure        = 1  MESSAGE v_ermsg
        communication_failure = 2  MESSAGE v_ermsg.

  • 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

  • Error loading csv file from application server

    Hi all,
    While uploading a csv file from the application server to psa we are getting the following error,
    Error 2 while splitting CSV data record
    Message no. RSDS_ACCESS011
    Diagnosis
    Error 2 occurred while splitting the CSV data record 1
    1 = Could not find a closing escape character
    2 = Invalid escape character
    3 = Conversion error
    4 = Other error
    System Response
    The function was terminated.
    Procedure
    Check the values of the data separator and escape sign, and try again.
    But i've checked the file and the escape sign, data seperator in it also. Everything is fine.  The same file we are able to load successfully in quality system.
    How to solve this error??
    Thanks in advance.

    Hi BI consultant:
       Could you please provide more details?
    For example:
    1.Is your P application server a UNIX flavor? (Solaris, AIX, UX, Linux)
       If yes..
             2. Are you able to see the contents of the file correctly with a "cat" or "vi" command? (at operating system level).
                   If no...
                         3. Did you upload the csv flat file to the server via FTP?
                                If yes...
                                     4. Did you use the "binary" or the "ascii" parameter on the FTP command used to upload the file?
    Probably you need to upload the CSV file again to your application server and make sure you can se the file contents ("cat" or "vi" command) before trying to execute the InfoPackage.
    Regards,
    Francisco Milán.
    Edited by: Francisco Milan on Jun 3, 2010 11:13 AM

  • When using a Seagate 1T external hard drive and Time Machine to back up hourly, if I delete photo files from the Mac hard drive before the next back up, are these retained on the Seagate drive or will they be lost (overwritten) in the next backu in the ne

    Does Time Machine erase previously saved files if, say, photos are deleted from the Macbook upon the next update, or will they be stored indefinately despite the current status of the files stored on the computer? Eg. can I bckup photo files to a Seagate 1T disc and then delete them to make more room on the computer in the knowlwdge that they are always going to be on the Seagate disc? Sorry if this is very elementary but I have not used a back up before like this, and am not sure how successive backups are overlaid or retained. Thanks!!

    TM is not designed to do what you ask. As Allan wrote TM is an incremental backup not an archival solution.
    If you delete a file from the HD it will eventually be removed from the TM backup (if it ever makes it on to the backup at all).
    How long before it is removed depends on a number of factors, TM disk drive size being one factor but not the only one.
    Material that is impossible to replace and is important to you (image files usually fitting that description) need to be backed up to as least one other drive and preferably more for long term storage.

  • 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

  • I am using the desktop screensaver and a file from dropbox for photos.  Does the list of screen savers actually use the file, or just link to it.  If I delete the file from the dropbox, will the screen saver be lost?

    Using the desktop slideshow, I have added a file from dropbox for the slideshow.  If I delete the dropbox file, does that delete the file from the list on the slideshow?  Do I need to leave the file on the computer itself rather than in the dropbox and then delete it from the dropbox?

    If you are going to delete the file from Dropbox, you will need the file on your computer.
    You will probably need to put the file in Library/Screen Savers

Maybe you are looking for

  • Mac won't open my external HD

    Hi,      I have an external Hard-Drive and I have always used it in my macbook. The HD has 2 partitions (Fat and exFat). When I open Disk Utility appears the name of the partitions but in grey letters. What should I do? PS.: I`m using OS X Yosemite

  • Media encoder does not open

    Issue: When trying to export Media a note comes up saying I have not the latest AME. Trying to update it shows though I have all the latest updates. Clicking OK lets me then select export workarea and do the settings needed for the export. Clicking "

  • Multi-clip audio editing?

    Hi all, I'm sure this is  a very easy fix, but I can't figure out anything from the manual. I shoot a lot of school sports and now that I'm doing basketball indoors, the audio is generally too hot. Because I stop and start recording during time-outs

  • Suddenly this morning all sound disappeared from youtube youtube via Firefox. Any other ideas? I've performed a SMC, repaired disk permissions, turned up volume.

    On my iMac this morning I watched and listened to a youtube segment. I tried to replay it. No sound at all. I checked the volume,  performed a SMC, repaired the disk permissions. I have the AppleCare Protection Plan and called them. Talked to them fo

  • Starting web server in Solaris10

    Hi Experts I am setting up nagios monitoring tool in solaris 10 my question is is there any default web server is installed in solaris 10 like linux is having apache .I saw apache folder in /usr directory if it is there could you please tell me how t