Skip to main content

Copy a Full Directory via API

Comments

3 comments

  • KostonConsulting
    I don't believe that copy directory is an option in the cPanel File Manager. There's no option to copy a directory in the UI and the API call states that sourcefiles should be a comma-delimited list so it doesn't appear to be a recursive copy. Out of curiosity, why not just use FTP instead of the cPanel API? ftp_put has some code samples for copying directory structures.
    0
  • dalem
    or easier yet just use ssh and use the cp-r command
    0
  • spyke01
    [quote="KostonConsulting, post: 1471102">I don't believe that copy directory is an option in the cPanel File Manager. There's no option to copy a directory in the UI and the API call states that sourcefiles should be a comma-delimited list so it doesn't appear to be a recursive copy. Out of curiosity, why not just use FTP instead of the cPanel API? ftp_put has some code samples for copying directory structures.
    This would be a nice solution for us in some cases but we have a client that has several directories around 200MB or more, with FTP it doesn't appear that we can copy from one remote directory to another remote directory so we'd have to download the files then re-upload. Alternatively a combination of FTP to get a list of the files and then using the API with the comma delimited list to copy them might work. [quote="dalem, post: 1471171">or easier yet just use ssh and use the cp-r command
    This actually looks like a good way to accomplish this quickly. We will probably use the ssh2 php commands. Thanks for the heads up.
    0

Please sign in to leave a comment.