Class: Net::FTP

Inherits:
Object
  • Object
show all
Defined in:
lib/technoweenie/attachment_fu/backends/ftp_backend.rb

Overview

Instance Method Summary collapse

Instance Method Details

#makedirs_(path) ⇒ Object

The ftp-equivalent of ‘mkdir -p path’ However, if ftp-user doesn’t have required permissions the method does not fail, while the path has not been created



247
248
249
250
251
252
253
254
# File 'lib/technoweenie/attachment_fu/backends/ftp_backend.rb', line 247

def makedirs_(path)
  route = []
  path.split(File::SEPARATOR).each do |dir|
    route << dir
    current_dir = File.join(route)
    mkdir(current_dir) rescue nil # if dir exists, ignore
  end
end