Movefile gives unknown error upon moving .txt files
6 ビュー (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
回答 (4 件)
suresh regana
2018 年 11 月 2 日
編集済み: suresh regana
2018 年 11 月 2 日
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 件のコメント
Jan Keij
2019 年 9 月 18 日
Excellent suggestion! Thank you. I got an "Unknown error" from "movefile" when I tried to rename a folder. "fclose all" did the trick.
Subhra Saha
2016 年 4 月 28 日
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.
0 件のコメント
Wayne
2018 年 8 月 21 日
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')?
0 件のコメント
neuromechanist
2019 年 11 月 19 日
For me it was the wirte permission, so I needed to run MATLAB as admin or change the permission level of the files.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!