drive: Add error for purge with --drive-trashed-only - fixes #3407

Purge should not be used with --drive-trashed-only flag as it leads to
unexpected behavior. After this commit if TrashedOnly option is set to
true, error message is returned.

See also: https://forum.rclone.org/t/drive-trashed-only-weird-occurrence/11066/14
This commit is contained in:
ginvine 2019-08-14 15:34:52 +03:00 committed by Nick Craig-Wood
parent 23a0332185
commit 1e7bc359be

View File

@ -1941,6 +1941,9 @@ func (f *Fs) Purge(ctx context.Context) error {
if f.root == "" {
return errors.New("can't purge root directory")
}
if f.opt.TrashedOnly {
return errors.New("Can't purge with --drive-trashed-only. Use delete if you want to selectively delete files")
}
err := f.dirCache.FindRoot(ctx, false)
if err != nil {
return err