Borrar filtros
Borrar filtros

What this code do?

3 visualizaciones (últimos 30 días)
subha
subha el 24 de Jun. de 2014
Editada: Image Analyst el 4 de Mayo de 2020
I would like to know what this code does?
dos('rm *.ascii');
thanks

Respuestas (2)

Geoff Hayes
Geoff Hayes el 24 de Jun. de 2014
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 comentarios
subha
subha el 24 de Jun. de 2014
thanks
Geoff Hayes
Geoff Hayes el 24 de Jun. de 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...

Iniciar sesión para comentar.


Image Analyst
Image Analyst el 24 de Jun. de 2014
Editada: Image Analyst el 4 de Mayo de 2020
rm is a Unix command: https://en.wikipedia.org/wiki/Rm_%28Unix%29 not a DOS command.
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 comentarios
subha
subha el 25 de Jun. de 2014
ok. thanks
Waqar Khan
Waqar Khan el 4 de Mayo de 2020
Thank you

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