Class: BrickFTP::RESTfulAPI::DeleteFolder

Inherits:
Object
  • Object
show all
Includes:
Command
Defined in:
lib/brick_ftp/restful_api/delete_folder.rb

Overview

Delete a file or folder

See Also:

Instance Method Summary collapse

Methods included from Command

included, #initialize

Instance Method Details

#call(path, recursive: false) ⇒ Object

Deletes a file or folder.

If true, will recursively delete folers. Otherwise, will error on non-empty folders.

Parameters:

  • path (String)

    Full path of the file or folder. Maximum of 550 characters.

  • recursive (Boolean) (defaults to: false)


21
22
23
24
25
26
27
# File 'lib/brick_ftp/restful_api/delete_folder.rb', line 21

def call(path, recursive: false)
  url = "/api/rest/v1/files/#{ERB::Util.url_encode(path)}"
  url += '?recursive=true' if recursive

  client.delete(url)
  true
end