How would I go about scheduling a monthly file transfer (via FTP) to send files in a specific directory on my remote VPS to a server on my internal Corporate network? Once files are transferred, I'd also like to job to delete the files on the VPS?


If you absolutely need it, Drupal has hook_cron() for regular task running:

function MYMODULE_cron() {
  // Copy your files here using standard php FTP functions

But it would be considerably more efficient to leave Drupal out of this altogether, and set it up with a basic rsync/FTP cron job executed on the server.

Alternatively, Backup and Migrate can both take a dump of the public/private file system and transfer it to an FTP target. Again, a solution outside Drupal will always be more efficient as it won't bootstrap the application.

  • Thanks Clive but I've never written a module or used hook_cron(). Dec 20 '16 at 15:11
  • If you don't want to develop a solution Backup and Migrate also has automatic scheduled backups built in. As I mentioned, it's not as efficient as writing your own solution, but if you don't want to do that it's certainly an alternative
    – Clive
    Dec 20 '16 at 15:25
  • Thanks Clive, I use Backup and Migrate for my database but I don't see a way to backup my public files to an FTP server, just NodeSquirrel which is a paid service? Dec 20 '16 at 15:51
  • Sorry I haven't actually used it myself, the module page does say explicitly: Backup to FTP/S3/Email or NodeSquirrel.com, that's what I was going off. Maybe there's a submodule that needs to be enabled? Or one of the other complementary modules listed on the module page?
    – Clive
    Dec 20 '16 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.