Movefile gives unknown error upon moving .txt files

6 visualizaciones (últimos 30 días)
Gadolinium
Gadolinium el 19 de Abr. de 2016
Comentada: Mahmoud Zorkot el 24 de Jul. de 2020
I have been trying to move some .txt files using the movefile function. While this works perfect for all other files but .txt files - using for instance:
movefile('*.script','scripts');
The command
movefile('*.txt','scripts');
will give "Error using movefile Unknown error occurred." Just to make things more strange: all .txt files are moved despite the error message, but the program stops anyway.

Respuestas (4)

suresh regana
suresh regana el 2 de Nov. de 2018
Editada: suresh regana el 2 de Nov. de 2018
Hi
it may help you.
Before executing the command movefile('*.script','scripts'); make sure all files should be closed.
try this:
fclose all;
movefile('*.script','scripts');
  2 comentarios
Jan Keij
Jan Keij el 18 de Sept. de 2019
Excellent suggestion! Thank you. I got an "Unknown error" from "movefile" when I tried to rename a folder. "fclose all" did the trick.
Mahmoud Zorkot
Mahmoud Zorkot el 24 de Jul. de 2020
thanks. really help

Iniciar sesión para comentar.


Subhra Saha
Subhra Saha el 28 de Abr. de 2016
Does this happen only with a particular directory? Does the error show up when you move one text file? Try giving the full path of the files and then try running the command.

Wayne
Wayne el 21 de Ag. de 2018
I ran into this error and realized I had multiple files (in different directories) of the same name. Perhaps you have text files of the same name in your matlab path? Maybe try changing it to movefile('.\*.txt', 'scripts')?

neuromechanist
neuromechanist el 19 de Nov. de 2019
For me it was the wirte permission, so I needed to run MATLAB as admin or change the permission level of the files.

Categorías

Más información sobre Data Type Conversion 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