Sha256: ce2e291f73847305822bfdf0cd7620ded37e285048df5fdf754544fe2b18fc20

Contents?: true

Size: 795 Bytes

Versions: 7

Compression:

Stored size: 795 Bytes

Contents

# frozen_string_literal: true 

require_relative 'command_handler'

module Ftpd

  class CmdMdtm < CommandHandler

    def cmd_mdtm(path)
      ensure_logged_in
      ensure_file_system_supports :dir
      ensure_file_system_supports :file_info
      syntax_error unless path
      path = File.expand_path(path, name_prefix)
      ensure_accessible(path)
      ensure_exists(path)
      info = file_system.file_info(path)
      mtime = info.mtime.utc
      # We would like to report fractional seconds, too.  Sadly, the
      # spec declares that we may not report more precision than is
      # actually there, and there is no spec or API to tell us how
      # many fractional digits are significant.
      mtime = mtime.strftime("%Y%m%d%H%M%S")
      reply "213 #{mtime}"
    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ftpd-2.1.0 lib/ftpd/cmd_mdtm.rb
ftpd-2.0.5 lib/ftpd/cmd_mdtm.rb
ftpd-2.0.4 lib/ftpd/cmd_mdtm.rb
ftpd-2.0.3 lib/ftpd/cmd_mdtm.rb
ftpd-2.0.2 lib/ftpd/cmd_mdtm.rb
ftpd-2.0.1 lib/ftpd/cmd_mdtm.rb
ftpd-2.0.0 lib/ftpd/cmd_mdtm.rb