Sha256: 88e6423ca4ea97097141e7e426b642da04421ccec3d86902a131cb49dc4b83b8

Contents?: true

Size: 814 Bytes

Versions: 11

Compression:

Stored size: 814 Bytes

Contents

require_relative 'command_handler'

module Ftpd

  class CmdRename < CommandHandler

    def cmd_rnfr(argument)
      ensure_logged_in
      ensure_file_system_supports :rename
      syntax_error unless argument
      from_path = File.expand_path(argument, name_prefix)
      ensure_accessible from_path
      ensure_exists from_path
      @rename_from_path = from_path
      reply '350 RNFR accepted; ready for destination'
      expect 'rnto'
    end

    def cmd_rnto(argument)
      ensure_logged_in
      ensure_file_system_supports :rename
      syntax_error unless argument
      to_path = File.expand_path(argument, name_prefix)
      ensure_accessible to_path
      ensure_does_not_exist to_path
      file_system.rename(@rename_from_path, to_path)
      reply '250 Rename successful'
    end

  end

end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
ftpd-1.1.1 lib/ftpd/cmd_rename.rb
ftpd-1.1.0 lib/ftpd/cmd_rename.rb
investtools-ftpd-1.0.1 lib/ftpd/cmd_rename.rb
ftpd-1.0.1 lib/ftpd/cmd_rename.rb
ftpd-1.0.0 lib/ftpd/cmd_rename.rb
ftpd-0.17.0 lib/ftpd/cmd_rename.rb
ftpd-0.16.0 lib/ftpd/cmd_rename.rb
ftpd-0.15.0 lib/ftpd/cmd_rename.rb
ftpd-0.14.0 lib/ftpd/cmd_rename.rb
ftpd-0.13.0 lib/ftpd/cmd_rename.rb
ftpd-0.12.0 lib/ftpd/cmd_rename.rb