Move to function deletes target folder

Advertisement

MarcoF
Joined:
Posts:
6
Location:
Naples

Move to function deletes target folder

I used the Move to (F6) function to move a folder into another folder with other files. The result is that I moved the folder but deleted all the other files that were already inside. How do I recover them? Help me

Reply with quote E-mail

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: Move to function deletes target folder

@MarcoF: F6 is for "Upload/Download and Delete", not for "Move to" (that's Shift+F6). So what did you do exactly? Please give us step by step description. Are you able to reproduce the problem? Neither "Upload/Download and Delete" nor "Move to" delete any additional files (except those moved/overwritten).

Reply with quote

MarcoF
Joined:
Posts:
6
Location:
Naples

Re: Move to function deletes target folder

@martin: Ok, I'll give you an example of what happened. I have two directories on the same level, A and B, both containing some files. I move directory A into directory B using the "Move to" command. The result is that in B there are only the files of A. So the files of B and the folder A disappeared.

Neither "Upload/Download and Delete" nor "Move to" delete any additional files (except those moved/overwritten)
Now starting from this assumption, where can I find 2gb of data that were inside the B folder? Since they disappeared after using the "Move to" function, is there a way to recover them along with the structure or to restore the structure as it was before?
That data was very important to me.

Reply with quote E-mail

martin
Site Admin
martin avatar

Re: Move to function deletes target folder

@MarcoF: So can you reproduce the problem? (on some test files) If you can, can you send me the session log file? That might help me to understand what has happened and where might the files went to.

Reply with quote

Advertisement

MarcoF
Joined:
Posts:
6
Location:
Naples

Re: Move to function deletes target folder

This is what happened after asking WinSCP to move the ws folder into the guru folder.
Description: this is what happened after asking WINSCP to move the ws folder into the GURU folder

Reply with quote E-mail

MarcoF
Joined:
Posts:
6
Location:
Naples

Re: Move to function deletes target folder

@martin: Yes. I send you the video but I stop when the overwrite window appears.
The second part of the video concerns the reverse action which instead works without problems and without proposing any (incomprehensible) overwriting request. However you can reproduce the problem yourself, as many times as you like.

Reply with quote E-mail

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: Move to function deletes target folder

Ok, now I understand. You are not moving gh to guru. You are moving gh to app under name guru. So basically, you are renaming gh to guru. That's why WinSCP asked about overwrite and that's why after you confirmed the overwrite, WinSCP deleted the guru and renamed gh to guru.

The correct input to move the gh to guru would be /var/www/html/app/guru/gh (that's what you would get had you drag&droped gh to guru) or just /var/www/html/app/guru/.

I'm sorry, but that means your files are lost.

I'll improve the "overwrite" prompt to be more explicit about the consequences:
Issue 2209 – Improve behavior when moving/renaming over an existing folder

Reply with quote

Advertisement

MarcoF
Joined:
Posts:
6
Location:
Naples

Re: Move to function deletes target folder

@martin: Dear Martin, WinSCP is a client that I love and have been using for many years. But in the case of the "Move to" function your approach is completely wrong. Because, regardless of the correctness of the path chosen, it cannot carry out such a disastrous overwrite operation. For example, in my case a gh directory already existed in the guru directory, so the override request appeared consistent to me.
In reality, as demonstrated by Linux's native 'move to' function, such a disaster just can't (must not) never happen.

Reply with quote E-mail

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: Move to function deletes target folder

@MarcoF: OK, I've improved it further to check if the target is an existing remote folder. If it is, WinSCP will imply the trailing slash, even if it is not present. I hope that this is what you refer to "Linux's native 'move to' function".

I'm sending you an email with a development version of WinSCP to the address you have used to register on this forum.

Reply with quote

anon
Guest

Same thing happened to me, lost a bunch of important files, strange thing is ext4magic can't even find they were deleted.

Basically in WinSCP moved one folder NameA containing some sub-folders into another folder which also contained a folder named NameA containing some of the same sub-folders, but with files in them.

WinSCP popped up a prompt and I thought it was similar to Windows when merging folders, but it just overwrite the entire contents. I don't think Linux allows that with the mv command, seems like WinSCP should use rsync for merging and be even more explicit.

Reply with quote

Advertisement

You can post new topics in this forum