some files and subfolders disappear while using movefile()
Show older comments
Hi,
By mistake I use the movefile to move my current directory to a new one. by using movefile('.','newfolder'); In this case, some files and subfolders are moved but some are disappeared. I don't know the reason but the remain filenames strat with 'p' to 'z' and the disappeared filenames strat with 'a' to 'p'.
would you please help me that where and how I can find them?
I search for deleted files with some recovery softwares, but I just can recover some of them from the newfolder.
3 Comments
fahime jam teh
on 27 May 2021
Jan
on 27 May 2021
Actually it should not be possible to move the current folder, because it is open in an application. I can try it in Octave only, where trying to move "." stops with an error message.
If you do not have a backup and tools like Recuva cannot find your files, they are gone.
Answers (1)
Jan
on 30 May 2021
I tried it on a Windows PC with Matlab R2018b now:
cd(tempdir);
mkdir('MyTest')
cd('MyTest');
for k = 'a':'z'
imwrite(rand(10, 10, 3), [k, '.png']);
end
movefile('.', 'MyTest_copied')
% Or: movefile('.', '..\MyTest_copied')
It does work and no files vanish. In the last case the empty folder MyTest does still exist, because the OS cannot delete itas long as it is the current folder in Matlab.
This means, that I do not have an explanation why some files are missing on your computer.
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!