Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By mrahman252003 on
I like to connect to remote FTP client and check if there is new files there on time to time basis.
If there are new files, I like to download it and send email to a person.
How can I do that? Is there any module?
Comments
How does this relate to
How does this relate to Drupal? What files are you checking for?
It is related Drupal, I like
It is related Drupal, I like to check when there the cron is executed probably by a custom module. Or by some other way (that I don't know if possible or not). I want to automate the process. Now I am doing manually. For this I created a cron monitor module and each cron run I do the FTP connection and transfer the files, but problems are there,
-not sure if it is right way to do that.
-I need to save password and ftp account in the php code, security?
-My theme changes due to this, not sure where is problem
Now can you advise me?
What files are you checking
What files are you checking on?
It can be any files/folders
It can be any files/folders (txt, images). Idea if it is new then that should be downloaded to my site (in a local directory)
You can implement hook_cron()
You can implement hook_cron() which will be executed on Drupal cron runs. You can then use drupal_http_request() to make your FTP connection.
Thanks, I tried to implement
Thanks, I tried to implement the module and it works with problem
-It changes my theme not sure why.
-I need to keep ftp password, is it safe to put it there in .module file?
I found another way running the php script with cron job provided by cpanel (https://www.drupal.org/node/369267)
It looks it is doing my work but again question where to store the ftp password?