Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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:
    56
    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

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

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

    Regards,
    -DavidN
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. nesanjoseph

    nesanjoseph Active Member

    Joined:
    Dec 31, 2010
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    56
    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 Well-Known Member

    Joined:
    Apr 29, 2005
    Messages:
    416
    Likes Received:
    1
    Trophy Points:
    243
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. nesanjoseph

    nesanjoseph Active Member

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

    Nesan Joseph R.
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice