MATLAB Function Reference Previous page   Next Page
recycle

Set option to move deleted files to recycle folder

Syntax

Description

S = recycle returns a character array S that shows the current state of the MATLAB file recycling option. This state can be either on or off. When file recycling is on, MATLAB moves all files that you delete with the delete function to either the recycle bin on the PC or Macintosh, or a temporary directory on UNIX. (To locate this directory on UNIX, see the Remarks section below.) When file recycling is off, any files you delete are actually removed from the system.

The default recycle state is off. You can turn recycling on for all of your MATLAB sessions using the Preferences dialog box (Select File -> Preferences -> General). Under the heading Default behavior of the delete function select Move files to the Recycle Bin.

S = recycle state sets the MATLAB recycle option to the given state, either on or off. Return value S shows the previous recycle state.

S = recycle('state') is the function format for this command.

Remarks

On UNIX systems, you can locate the system temporary directory by entering the MATLAB function tempdir. The recycle directory is a subdirectory of this temporary directory, and is named according to the format

For example, files recycled on a UNIX system at 2:09:28 in the afternoon of November 9, 2004 would be copied to a directory named

To set the recycle state for all MATLAB sessions, use the Preferences dialog box. Open the Preferences dialog and select General. To enable or disable recycling, click Move files to the recycle bin or Delete files permanently. See General Preferences for MATLAB in the Desktop Tools and Development Environment documentation for more information.

You can recycle files that are stored on your local computer system, but not files that you access over a network connection. When you use the delete function on files accessed over a network, MATLAB removes the file entirely.

Examples

Start from a state where file recycling has been turned off. Check the current recycle state:

Turn file recycling on. Delete a file and verify that it has been transferred to the recycle bin or temporary folder:

See Also

delete, dir, ls, fileparts, mkdir, rmdir


Previous page  rectint reducepatch Next page

© 1994-2005 The MathWorks, Inc.