Some files disappeared after using movefile

10 Ansichten (letzte 30 Tage)
John Githaka
John Githaka am 27 Okt. 2019
Bearbeitet: John Githaka am 27 Okt. 2019
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 Kommentare
John Githaka
John Githaka am 27 Okt. 2019
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 am 27 Okt. 2019
Bearbeitet: John Githaka am 27 Okt. 2019
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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by