recycle

Set option to move deleted files to recycle folder

Syntax

Description

example

status = recycle returns the current state for recycling files you remove using the delete function. When status is off, the delete function permanently removes the files. When status is on, deleted files move to a different location. For details, see the Tips section.

example

oldState = recycle(state) sets the recycle option for MATLAB® to the specified state, either on or off. The previousStat value is the recycle state before running the statement.

Examples

expand all

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 file recycling on. Then, delete an existing file and move it to the recycle bin or temporary folder.

recycle('on');
delete('myfile.txt')

Input Arguments

expand all

state — State of recycle option'on' | 'off'

State of the recycle option, specified as 'on' or 'off'.

More About

expand all

Tips

  • The location for storing recycled files varies by platform, as follows:

    • Microsoft® Windows® systems — Recycle bin.

    • Apple Macintosh systems — Trash.

    • Linux® systems — Subfolder with the prefix MATLAB_Files_ in the system temporary folder, as returned by the tempdir function.

  • The general preference for Deleting files sets the state of the recycle function at startup. When you change the preference, it changes the state of recycle. However, when you change the state of recycle, it does not change the preference.

See Also

| | |

Was this topic helpful?