From: Catherine on
"Chris" <chris.nospam(a)mathworks.com> wrote in message <hg5irp$hc1$1(a)fred.mathworks.com>...
> "Kevin" <khung(a)fake.com> wrote in message <hf1hv8$2dn$1(a)fred.mathworks.com>...
> > I have seen this before but just don't have time to look into it. Actually there is not much that I can do since MOVEFILE is a built-in function.
> >
> > I use MOVEFILE to rename file but it seems to me that it takes some time if the file is large. This should not happen.
> >
> > Am I missing something?
>
> I suspect there is some dependence on the number of files in the directory you are moving files from. I'm trying to use matlab to move images that meet a certain criteria, & although none over 100kb in size, the movefile function takes over a minute per file. The dos('move ...') takes 10s (including loading and some arithmatic) per file, which is considerably quicker, but still slow!

I found a similiar issue - when I did a practice run on a folder with <100 .wav files, it went very fast (~.1s/file), but on the full folder with over 4000 .wav files it slowed down to around 5 seconds a file. BUT, the interesting thing is that if I wavread in the file, then wavwrite it back out as a new filename - it only takes .3s/file, even with the 4000 file folder. That doesn't seem right. I tried the following renaming lines (ofn: oldfilename, nfn: newfilename):

movefile(ofn, nfn)
dos(['rename ' ofn ' ' nfn]);
copyfile(ofn,nfn)
system([localmovename ' ' ofn ' ' nfn]);

Does anyone understand this?