The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fileman::delfile question

Discussion in 'cPanel Developers' started by nesanjoseph, Jul 7, 2011.

  1. nesanjoseph

    nesanjoseph Active Member

    Joined:
    Dec 31, 2010
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    6
    Hi,

    I tested the API call Fileman::delfile and found that it just moves the file to ~/.trash folder. Even if we try to delete a file inside .trash folder, it just renames to filename.1 and appends .1 everytime if that file is already present.

    Is there an API call to delete a file permanently [without moving to .trash]? Or any alternate workaround?

    Many thanks,
    Nesan Joseph R.
     
  2. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi nesanjoseph,

    You can use the API2 Fileman::fileop call, using the 'unlink' op.

    Regards,
    -DavidN
     
  3. nesanjoseph

    nesanjoseph Active Member

    Joined:
    Dec 31, 2010
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    6
    Hi,

    Thanks for the information. However, that does not work for me! :-(

    Following is the URL I access to delete the file "testdelfile.txt" permanently. But this is not working. Could you please check and update me what am i doing wrong.

    $url = "https://cptestserver:2083/xml-api/cpanel?user=user1&cpanel_xmlapi_module=Fileman&cpanel_xmlapi_func=fileop&cpanel_xmlapi_apiversion=1&op=unlink&sourcefiles=/home/user1/testdelfile.txt";

    Following is the output i receive:
    -------------------------------8<----------------------------------
    <?xml version="1.0" ?> <cpanelresult><module>Fileman</module><func>fileop</func><type>event</type><source>internal</source><apiversion>1</apiversion><data><result></result></data> <event> <result>1</result> </event> </cpanelresult>
    ------------------------------->8----------------------------------

    Many thanks in advance,
    Nesan Joseph R.
     
  4. MattDees

    MattDees cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Code:
    $url = "https://cptestserver:2083/xml-api/cpanel?user=user1&cpanel_xmlapi_module=Fileman&cpanel_xmlapi_func=fileop&[B]cpanel_xmlapi_apiversion=1[/B]&op=unlink&sourcefiles=/home/user1/testdelfile.txt";
    
    This should be cpanel_xmlapi_apiversion=2
     
  5. nesanjoseph

    nesanjoseph Active Member

    Joined:
    Dec 31, 2010
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    6
    Thanks for correcting me. That worked!

    Nesan Joseph R.
     
Loading...

Share This Page