Moves files from one location to another via FTP while preserving their folder structure. Get notifications when the files have been uploaded.
Create a config.yml and set the following.
ftp_settings:
host: example.com
username: example
password: pa55word
source: /downloads
destination: /files
exclude: [dir1, dir2]
Inside config.yml, add your notifier to the notifications list and include any settings.
notifications:
email:
some: setting
settings:
- setting
- setting
- Class name must start with the name given in the
config.ymlnotifications and end withNotifiersuch asEmailNotifier.notifier_manager.rbwill initialize each notifier with a hash of the config settings. - Implement an
updatemethod. This is called once the files have been uploaded. A list of uploaded files will be passed to this method.
config = YAML.load_file(File.join(__dir__, 'config.yml'))
notifier_manager = NotifierManager.new
notifier_manager.add_notifiers(config)
ftp_transfer = FtpTransfer.new(config, notifier_manager)
ftp_transfer.run