Set option to move deleted files to recycle folder
status = recycle returns the current state for recycling files you remove
delete function. When
delete function permanently removes the files. When
moves the files to a different location, which varies by platform:
Windows® — Recycle bin.
macOS — Trash.
Linux® platforms — Subfolder with the prefix
MATLAB_Files_in the system temporary folder, as returned by the
On macOS, the
recycle option is not applied to
files deleted from network drives.
View Current Recycling State
Start from a state where file recycling is off. Verify the current recycle state.
state = recycle
state = off
Turn File Recycling On
Turn on file recycling. Then, delete an existing file and move it to the recycle bin or temporary folder.
state — State of recycle option
State of the recycle option, specified as
You also can set the recycle option for MATLAB using preferences. To do so, go to the Home tab and in the Environment section, click Preferences. Select MATLAB > General. Then, in the Deleting files section, select from the available options. By default, the Delete permanently option is selected.
Introduced before R2006a
rmdir | Preferences