some files and subfolders disappear while using movefile()

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

Jan
Jan on 27 May 2021
Edited: Jan on 27 May 2021
Are you working under Windows? Did you enable the "previous versions" or the File System History? If not, the rule is:
"File, for which no backup is existing, a backup are not important."
Sorry, I hope you find your data.
thank you for your reply.
Yes I'm working under windows.
Unfortunatly no I wasn't familier with this option and it wasn't enable.
I just have the backup of them two months ago. :(
Why did this happen?
Is there any solution
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.

Sign in to comment.

Answers (1)

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.

Asked:

on 27 May 2021

Answered:

Jan
on 30 May 2021

Community Treasure Hunt

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

Start Hunting!