Method: Net::SFTP::Session#rename
- Defined in:
- lib/net/sftp/session.rb
#rename(name, new_name, flags = nil, &callback) ⇒ Object
:call-seq:
rename(name, new_name, flags=nil) -> request
rename(name, new_name, flags=nil) { |response| ... } -> request
Renames the given file. This operation is only available in SFTP protocol versions two and higher. The flags parameter is ignored in versions prior to 5. In versions 5 and higher, the flags parameter can be used to specify how the rename should be performed (atomically, etc.).
The following flags are defined in protocol version 5:
-
0x0001 - overwrite an existing file if the new name specifies a file that already exists.
-
0x0002 - perform the rewrite atomically.
-
0x0004 - allow the server to perform the rename as it prefers.
580 581 582 |
# File 'lib/net/sftp/session.rb', line 580 def rename(name, new_name, flags=nil, &callback) request :rename, name, new_name, flags, &callback end |