class FakeFtp::ServerCommands::Mdtm

Public Instance Methods

run(ctx, filename = '', *) click to toggle source
# File lib/fake_ftp/server_commands/mdtm.rb, line 6
def run(ctx, filename = '', *)
  ctx.respond_with('501 No filename given') && return if filename.empty?
  server_file = ctx.file(filename)
  ctx.respond_with('550 File not found') && return if server_file.nil?

  ctx.respond_with(
    "213 #{server_file.last_modified_time.strftime('%Y%m%d%H%M%S')}"
  )
end