Skip to content

Commit

Permalink
yandex: implement cleanup (empty trash) - addresses rclone#575
Browse files Browse the repository at this point in the history
  • Loading branch information
ishuah committed Sep 7, 2017
1 parent fe536f3 commit ae11545
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/content/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ operations more efficient.
| Openstack Swift | Yes † | Yes | No | No | No | Yes | No [#1614](https://github.com/ncw/rclone/issues/1614) |
| QingStor | No | Yes | No | No | No | Yes | No [#1614](https://github.com/ncw/rclone/issues/1614) |
| SFTP | No | No | Yes | Yes | No | No | Yes |
| Yandex Disk | Yes | No | No | No | No [#575](https://github.com/ncw/rclone/issues/575) | Yes | Yes |
| Yandex Disk | Yes | No | No | No | Yes | Yes | Yes |
| The local filesystem | Yes | No | Yes | Yes | No | No | Yes |

### Purge ###
Expand Down
6 changes: 6 additions & 0 deletions docs/content/yandex.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,9 @@ metadata called `rclone_modified` in RFC3339 with nanoseconds format.
### MD5 checksums ###

MD5 checksums are natively supported by Yandex Disk.

### Emptying Trash ###

If you wish to empty your trash you can use the `rclone cleanup remote:`
command which will permanently delete all your trashed files. This command
does not take any path arguments.
13 changes: 13 additions & 0 deletions yandex/api/empty_trash.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package src

// Empty trash will permanently delete all trashed files/folders from Yandex Disk
func (c *Client) EmptyTrash() error {
fullURL := RootAddr
fullURL += "/v1/disk/trash/resources"

if err := c.PerformDelete(fullURL); err != nil {
return err
}

return nil
}
5 changes: 5 additions & 0 deletions yandex/yandex.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,11 @@ func (f *Fs) Purge() error {
return f.purgeCheck("", false)
}

// CleanUp permanently deletes all trashed files/folders
func (f *Fs) CleanUp() error {
return f.yd.EmptyTrash()
}

// Hashes returns the supported hash sets.
func (f *Fs) Hashes() fs.HashSet {
return fs.HashSet(fs.HashMD5)
Expand Down

0 comments on commit ae11545

Please sign in to comment.