필터 지우기
필터 지우기

Overwriting the folder in matlab

조회 수: 18 (최근 30일)
Berbia
Berbia 2013년 1월 29일
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???

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 1월 29일
delete('yourfolder/*.*')
  댓글 수: 3
Berbia
Berbia 2013년 1월 29일
thank you...but my folder contains only similar files i.e)*.png
Azzi Abdelmalek
Azzi Abdelmalek 2013년 1월 29일
delete('yourfolder/*.png')

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Jason Ross
Jason Ross 2013년 1월 29일
  댓글 수: 2
Berbia
Berbia 2013년 1월 29일
My folder should be reused only the content should by deleted...
Jason Ross
Jason Ross 2013년 1월 29일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by