Ayoub Idelhoussain Ayoub Idelhoussain - 4 years ago 102
PHP Question

Moving files from one directory to another in the same remote server

I'm developing an application with Symfony2, and my users get to look at their folders (located in alfresco) but at a certain point some files need to be moved from one folder to another.

I tried

but didn't have much luck with it. I could rename a file's name with it but I couldn't move it from one location to another.

I tried looking at the alfresco docs but didn't find anything helpful because I'm developing an api and I can't use Cmis Js.

Answer Source

The ftp_rename can rename/move a single file only. You cannot use it to move all files in a directory to another.

So you have to:

  • list all files in the source directory, e.g. using the ftp_nlist.
  • call the ftp_rename for each, one-by-one.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download