Error using rmdir when trying to remove folder
17 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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.
0 commentaires
Réponses (1)
Walter Roberson
le 24 Avr 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.
0 commentaires
Voir également
Catégories
En savoir plus sur File Operations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!