Results 1 to 3 of 3

Thread: Delete Files/Dirs - API1 and/or API2

  1. #1
    Registered User
    Join Date
    Aug 2009
    Location
    Limassol, Cyprus
    Posts
    2

    Question Delete Files/Dirs - API1 and/or API2

    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 Code:
    $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 Code:

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

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

    PHP Code:

    $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
    Last edited by adelin.feraru; 11-17-2010 at 05:58 AM. Reason: Added some more space for the code

  2. #2
    Registered User
    Join Date
    Aug 2009
    Location
    Limassol, Cyprus
    Posts
    2

    Smile Re: Delete Files/Dirs - API1 and/or API2

    SOLVED!

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

    Hope I have helped others.
    IOAN
    Last edited by adelin.feraru; 11-17-2010 at 08:19 AM. Reason: Correction

  3. #3
    Member MattDees's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default Re: Delete Files/Dirs - API1 and/or API2

    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?
    Matt Dees

Similar Threads

  1. xml api2 delete addon domain help.
    By sirdopes in forum cPanel Developers
    Replies: 4
    Last Post: 07-28-2010, 05:10 PM
  2. XML-API issues with API1 and API2 commands
    By XenomediaBV in forum cPanel Developers
    Replies: 7
    Last Post: 09-14-2009, 11:34 AM
  3. List of all available API1 and API2 modules
    By ck in forum cPanel Developers
    Replies: 1
    Last Post: 04-27-2009, 10:43 AM
  4. Use API1 and API2
    By rongup in forum cPanel & WHM Discussions
    Replies: 38
    Last Post: 02-04-2009, 10:16 AM
  5. redundant mail account dirs - script to detect and delete?
    By spaceman in forum cPanel & WHM Discussions
    Replies: 0
    Last Post: 12-05-2005, 01:26 AM