What this code do?
Show older comments
I would like to know what this code does?
dos('rm *.ascii');
thanks
Answers (2)
Geoff Hayes
on 24 Jun 2014
2 votes
In the Command Window type help dos or doc dos. The dos function executes a DOS command and returns the result:
status = dos(command) executes the specified DOS command for Windows® platforms, and waits for the command to finish execution before returning the exit status to the status variable
The command string in this case is rm *.ascii which should remove all files with the ascii extension from the current directory.
2 Comments
subha
on 24 Jun 2014
Geoff Hayes
on 24 Jun 2014
I should have indicated that I ran this piece of code on my Mac where the rm command is valid and so will (and did!) remove all files with the ascii extension...
Image Analyst
on 24 Jun 2014
Edited: Image Analyst
on 4 May 2020
1 vote
Does that command even work, or does it throw an error?
For DOS, use del instead of rm. Or use the system() function instead of the dos() function.
4 Comments
subha
on 25 Jun 2014
Image Analyst
on 25 Jun 2014
Yeah, because it's not a DOS command. Try using del instead of rm if you want to run it.
subha
on 25 Jun 2014
Waqar Khan
on 4 May 2020
Thank you
Categories
Find more on Search Path in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!