Currently, the whole path will be downloaded and completely uploaded to the destination afterwards. There will be problems if the data set is bigger than the free disk space on the machine executing the script.
One possible solution would be downloading only one file, uploading it, deleting it and continue with the next file only when the deletion process of this first file is completed. Another solution would be mounting the source and destination to the file system (for example with curlftpfs) and copy the files "directly".