Borrar filtros
Borrar filtros

Overwriting the folder in matlab

18 visualizaciones (últimos 30 días)
Berbia
Berbia el 29 de En. de 2013
I've created the folder to write images on it by the code
outputFolder = fullfile(cd, 'folder_name');
if ~exist(outputFolder, 'dir')
mkdir(outputFolder);
and I'm in need to overwrite the same folder for writing another set of images. Is there any way to delete all the existing images in the folder for writing new images???

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 29 de En. de 2013
delete('yourfolder/*.*')
  3 comentarios
Berbia
Berbia el 29 de En. de 2013
thank you...but my folder contains only similar files i.e)*.png
Azzi Abdelmalek
Azzi Abdelmalek el 29 de En. de 2013
delete('yourfolder/*.png')

Iniciar sesión para comentar.

Más respuestas (1)

Jason Ross
Jason Ross el 29 de En. de 2013
  2 comentarios
Berbia
Berbia el 29 de En. de 2013
My folder should be reused only the content should by deleted...
Jason Ross
Jason Ross el 29 de En. de 2013
It's easier and safer (IMHO) to delete the directory with everything in it and then re-create it if you want to protect yourself from cruft or some error condition that pops up later because some other file is left over from a previous run ... or the wildcard match missed a .PNG file (or pNG, pNG, PNg, .png~ etc) ... or some other weirdess happens.

Iniciar sesión para comentar.

Categorías

Más información sobre File Operations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by