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.

Delete Files/Dirs - API1 and/or API2

Discussion in 'cPanel Developers' started by adelin.feraru, Nov 17, 2010.

  1. adelin.feraru

    adelin.feraru Registered

    Joined:
    Aug 10, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Limassol, Cyprus
    I was trying for 2 days to delete files and folders using the API2->Fileman->fileop function with no success. I was trying like this:

    PHP:
    $req $xmlapi->api2_query($cp_acc"Fileman""fileop", array("op"=>"trash""sourcefiles"=>"/public_html/some_file.php"));
    For some reason is not moving anything to .trash forlder.

    So I started to dig into API1 Fileman function. I had success deleteting files but not directories. Look how I try to remove dirs:

    Version 1:
    PHP:

    $delete_response 
    =  $xmlapi->api1_query($cp_acc"Fileman""killdir", array("/public_html/some_dir"));

    Version 2:
    PHP:

    $delete_response 
    =  $xmlapi->api1_query($cp_acc"Fileman""killdir", array("dir:public_html/some_dir"));

    Version 3:

    PHP:

    $delete_response 
    =  $xmlapi->api1_query($cp_acc"Fileman""killdir", array("dir:/public_html/some_dir"));

    Has anyone succeeded in removing directories using either API1 or API2 functions?

    Thank you in advance!
    IOAN
     
    #1 adelin.feraru, Nov 17, 2010
    Last edited: Nov 17, 2010
  2. adelin.feraru

    adelin.feraru Registered

    Joined:
    Aug 10, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Limassol, Cyprus
    SOLVED!

    The API2 Fileman's function for "deleting" files and/or folders is "unlink" not "trash".

    Hope I have helped others.
    IOAN
     
    #2 adelin.feraru, Nov 17, 2010
    Last edited: Nov 17, 2010
  3. 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
    Correct, the "trash" function actually copies/moves the files into a .trash directory

    Were you using our API docs to explore this issue? Is there an improvement that we could make to make this easier for others trying to use this function in the future?
     
Loading...

Share This Page