recycle - Set option to move deleted files to recycle folder

Syntax

S = recycle
S = recycle state
S = recycle('state')

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 Apple® Macintosh® computer, or a temporary directory on a computer running The Open Group 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

MATLAB_Files_<day>-<mo>-<yr>_<hr>_<min>_<sec>

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

/tmp/MATLAB_Files_09-Nov-2004_14_09_28

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® Application 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. On Windows® systems, 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:

recycle
ans =
   off

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

recycle on;
delete myfile.txt

See Also

delete, dir, ls, fileparts, mkdir, rmdir

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS