Code covered by the BSD License  

Highlights from
force_delete

Be the first to rate this file! 3 Downloads (last 30 days) File Size: 1.57 KB File ID: #40012

force_delete

by Alan

 

25 Jan 2013

Forces the deletion of a file; without the warning: File not found or permission denied.

| Watch this File

File Information
Description

Picture the scenario:

You have opened the same file twice, first for writing and then for reading, you now have two file identifiers for the one file. But you have 'misplaced' the one of the file identifiers that you were using. You use fclose on the remaining file identifier but then wonder why you are getting the 'File not found or permission denied' warning when you try to delete the file. Yes you could use fclose('all') but then you will close all the other files you have open as well.

Just use: force_delete(filename)

it will find all the file identifiers associated with your file, fclose them all and then delete your file.

Will not work if the file you want to delete is open in a program outside of MATLAB

Required Products MATLAB
MATLAB release MATLAB 7.14 (R2012a)
Tags for This File  
Everyone's Tags
data export, data import
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.

Contact us