Some files disappeared after using movefile

9 ビュー (過去 30 日間)
John Githaka
John Githaka 2019 年 10 月 27 日
編集済み: John Githaka 2019 年 10 月 27 日
I used movefile to rename thousands of files in a folder (by simply adding a prefix to the original name). To my surprise, almost three quarter of my files disappeared. Has anyone experienced this? Is this a bug? I'm using R2018a.
  3 件のコメント
John Githaka
John Githaka 2019 年 10 月 27 日
I'm pretty sure it's not the naming scheme. Below is my code (I was renaming tif files. There was no other software open except MATLAB). The files which remained were succesfully renamed.
%Current follder should be the one with images to rename
list=dir('*.tif');%get all tif files
list=extractfield(list,'name'); %get file names
h=waitbar(0,'progress');% progress bar
for i=1:length(list)
waitbar(i/length(list),h)%keep track of progress
OriginalName= list{i}; % define file to rename
NewName= ['Cell2_' OriginalName]; % get new file namename
movefile(OriginalName,NewName)
end
close(h)
John Githaka
John Githaka 2019 年 10 月 27 日
編集済み: John Githaka 2019 年 10 月 27 日
I've just figured out what went wrong. You were right, there's nothing wrong with movefile! I was renaming files in a shared remote hardrive that has scheduled file transfers to a backup drive everyday. It just so happened I run my code just when the scheduled transfer was starting!! I've found my missing files in the backup drive.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by