You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
Since delete command doesn't work on folders and rmdir deletes everything including the root folder, I have written this piece of code to remove/delete all the files and subfolders within a given folder without deleting the folder itself. Please specify the full path of the folder in order to empty it's contents.
Cite As
Ajay Kumar (2026). cleardir (https://www.mathworks.com/matlabcentral/fileexchange/155507-cleardir), MATLAB Central File Exchange. Retrieved .
General Information
- Version 2.0.0 (1.56 KB)
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
