Reputation: 6276
I need to upload a directory having sub-directories to a ftp server.
I can upload a file using
require 'net/ftp'
ftp = Net::FTP.new(options[:remote_host])
ftp.login(options[:username], options[:password])
ftp.put(File.open("filename"))
ftp.quit
It fails with uploading directory receiving error...
Errno::EISDIR: Is a directory
Can anyone give help?
Upvotes: 2
Views: 2654
Reputation: 1300
You will need to create the sub-directories and upload the files 'manually'. Every FTP client do it this way.
Upvotes: 2
Reputation: 13719
Net::FTP
implements FTP protocol and FTP uses MKD
command to create directories (different from commands used to create files). Net::FTP
can create directory with special Net::FTP#mkdir method.
mkdir(dirname)
Creates a remote directory.
Upvotes: 4