Some files disappeared after using movefile

9 visualizaciones (últimos 30 días)
John Githaka
John Githaka el 27 de Oct. de 2019
Editada: John Githaka el 27 de Oct. de 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 comentarios
John Githaka
John Githaka el 27 de Oct. de 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 el 27 de Oct. de 2019
Editada: John Githaka el 27 de Oct. de 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by