recycle

Gets or sets whether deleted files go to the recycle bin.

Category: Programming > Files and Folders

Syntax

state = recycle

Returns the current setting, 'on' or 'off'.

recycle(state)

Sets it to 'on' or 'off'.

Description

When the setting is on, delete and rmdir should move items to the operating system's recycle bin so they can be restored. When it is off, they remove items for good. The setting applies to the session.

Input arguments

state
'on' or 'off'.

Output arguments

state
The current setting.

Example

Reading the setting

recycle
Output
ans = 'off'

Notes

MatLivre has no recycle bin: recycle('on') is accepted but prints a warning, and delete still removes files permanently. The default is 'off'.

See also

delete rmdir movefile