Error using rmdir when trying to remove folder

17 visualizaciones (últimos 30 días)
rahul kochar
rahul kochar el 24 de Abr. de 2017
Respondida: Walter Roberson el 24 de Abr. de 2017
Hi
I am trying to remove a folder and all its contents during each run of the for loop. This is the code:
cd 'C:\Temp\A2matlab'
rmdir PsDTestHM1 s
This works well for a few runs and then stops and gives me the following error:
Error using rmdir
C:\Temp\A2matlab\PsDTestHM1\PsDTestHM1.log could not be removed.
C:\Temp\A2matlab\PsDTestHM1 could not be removed.
Error in AbaqusPS (line 1356)
rmdir PsDTestHM1 s
Any suggestions as to what I could be doing wrong?
Thank you.

Respuestas (1)

Walter Roberson
Walter Roberson el 24 de Abr. de 2017
The files are probably in use. For example you might need to fclose('all') if you wrote to them from within MATLAB. If the log file is a diary then you need to turn diary off (or change diary destinations.) If some external program is writing to the files, you need to make sure the external program has finished.

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by