"Cannot remove temporary directory" in WinSCP v6.3.7

Advertisement

spaceman
Joined:
Posts:
13

"Cannot remove temporary directory" in WinSCP v6.3.7

Hi

I am using Windows XP SP3, and I updated my WinSCP to the latest version that still support Windows XP – v6.3.7.

Now after the update a small problem occurs:
If I doubleclick a Text File in the remote pane,
the file opens for Editing on my computer,
but when I close the file, even without doing any change/save to it,
I get a messagebox with:
Cannot remove temporary directory 'C:\DOCUME~1\DIGITA~1\LOCALS~1\Temp\scp30375\'.

When I open WinSCP later, I get this window:


And when I click "Yes" to delete,
it seems that the same problem happens:


What should I do?

BTW,
when I checked the contents of these 3 folders,
they don't have any files in them, only empty sub-folders..
It seems that WinSCP does not delete them because theyhave sub-folders in them.

Thank you

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
42,067
Location:
Prague, Czechia

Re: "Cannot remove temporary directory" in WinSCP v6.3.7

What version were you using before? If you downgrade back, does the problem go away?
Are you able to delete those folders manually?

Reply with quote

spaceman
Joined:
Posts:
13

Hi Martin

Thank you very much for your help.

I am on Windows XP SP3, 32bit,
and I switched from WinSCP-5.15.9-Portable.zip to WinSCP-6.3.7-Portable.zip.

I am able to manually delete these folders.
When I checked their content, it seems there are no files in them,
but there are sub-folders in them.
The sub-folders inside them are like the folder structure on the remote computer, from the root directory, till the viewed/edited file's sub-directory directory.

And I think that's the reason why WinSCP can't delete them:
The command that is used to delete the temp folder, probably expects the folder to be deleted, to be completely empty (not just of files, but also of folders).
And because it is not empty, the command fails.
Probably if the same command was used with some Recursive flag, then it would succeed.

If you downgrade back, does the problem go away?
I have not tried that.
The reason I did not try that, is:
While I do have a backup copy of my WinSCP folder (all files in it, including WinSCP.ini),
I do know that WinSCP, even the portable version, stores some data in the Registry.



What's the problem with that?
If my older version (v5.15.9-Portable) stored some data there,
and then I switched to the newer version (v6.3.7-Portable),
then if the format of the data that is stored in the registry changed betwen those 2 versions,
then v6.3.7-Portable updated the format there.
So If you now try to run v5.15.9-Portable again,
it will meet a data structure that it does not expect..

See what I mean?

Reply with quote

spaceman
Joined:
Posts:
13

BTW:
Regarding the registry thing that I worried about,
I opened RegEdit, and went to the key described in that window:



Apparently there's no such key..

To verify, I even searched the whole registry for prikry,
while "Match whole string only" is set to Off.

Not a single result found.

So maybe it means that I can do the test that you asked for, without worrying about it?

Do you want me to go ahead and do it?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
42,067
Location:
Prague, Czechia

Downgrading should be safe. Please try it.

Also the subfolders should not be a problem. WinSCP deletes the temporary folders recursively.

Also, if you remove the folders manually, and retry whole operation, does the same problem happen again?

Reply with quote

Advertisement

spaceman
Joined:
Posts:
13

Downgrading should be safe. Please try it.
When I go back to v5.15.9-Portable, it works fine without this problem.
That's how it was all the time with it.
It never happened in v5.15.9-Portable.

When I come back to v6.3.7-Portable, the problem happens again.

Also, if you remove the folders manually, and retry whole operation, does the same problem happen again?
Yes of course..
It's not a 1 time issue,
it happens per each txt file that I try to edit on the remote machine.

And manually deleting past left overs, does nothing for future edits,
since each edit gets it own, new scp##### folder.

Also the subfolders should not be a problem.
WinSCP deletes the temporary folders recursively.
Actually that's not what happens.

This is what happens on v6.3.7-Portable, when you Edit a remote file:
  1. An scp##### folder is created in the Temp folder
  2. A folder structure (that is a copy of the remote folder structure, from the root folder, till the folder containing the file itself) is created inside the scp##### folder
  3. The actual file is copied to the bottom-most folder in the above created tree.
  4. Then, when you Exit editing the file:
    The file is deleted from the disk of the local computer
    but the folder structure created in #2 above, is not deleted.
    and then WinSCP tries to delete the scp##### folder, but fails,
    because the scp##### folder is not empty..
    While it does not have files in it, it does have folders in it, which were not deleted.
    And the Delete command for deleting the scp##### folder, probably does not include flag to delete sub-folders, if exist (which do exist..).

So IMHO, the sentence that you wrote:
Also the subfolders should not be a problem. WinSCP deletes the temporary folders recursively.
is not describing what's happening here..

Please tell me if you need more info.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
42,067
Location:
Prague, Czechia

I cannot reproduce the problem.
You wrote that you double-click the file. A double-click can be configured in WinSCP to do either Edit or Open. Which one are you using?
If Edit, what editor do you open the file in? An internal editor of WinSCP or some external editor? In external, can you share screenshot of its configuration?

There's quite a span between 5.15.9 and 6.3.7. Can you narrow down in what version of WinSCP was the problem introduced?

Reply with quote

spaceman
Joined:
Posts:
13

You wrote that you double-click the file. A double-click can be configured in WinSCP to do either Edit or Open. Which one are you using?
Double-click is set to Edit.

But out of curiosity, I tried to also right-click a text file, and then choose the Open menuitem,
and after closing it, the error about deleting the scp##### folder was not shown,
but,
after closing WinSCP, and reloading it, the message about
Do you want to delete past temporary folders?
did appear.

So even when Opening a file, a temporary folder is created, and not successfully deleted,
but for some reason no immediate error is shown,
and only when reloading WinSCP, the leftovers are found, and notified about..

If Edit, what editor do you open the file in? An internal editor of WinSCP or some external editor?
The built-in editor..
Never changed it.

There's quite a span between 5.15.9 and 6.3.7. Can you narrow down in what version of WinSCP was the problem introduced?
Yes, of course.
I will download all versions between these 2, and check,
hopefully I can find a certain point with a change,
this could definitely help you track some change in the code, that could hint the cause..

Will give you the result by tomorrow.

Reply with quote

spaceman
Joined:
Posts:
13

BTW
I decided to do some test to maybe pinpoint the problem.

I deleted all scp##### folder in Temp\,
and then started WinSCP.

I edited a remote file, which created an scp##### folder in Temp\
and also created the sub-folders structure in it, and in the end of the folder structure, was the file itself.

I exited the Editor (internal), and checked what happened:
The file itself was deleted,
but the folder structure, and the scp##### folder, were not deleted.

I closed WinSCP, and decided to "help" it a little but:
I went and deleted the sub-folders structure, and only left the scp##### folder.
I then reloaded WinSCP, and it notified me about a leftover folder, and I answered Yes to delete.
It failed too, even though the folder is completely empty, either of files, and folders.

So it is not as I assumed, that the sub-folders structure is preventing the deletion, because maybe the delete command does not include the Recurse flag.
Even just a single scp##### folder, with nothing in it, is not deleted.

Reply with quote

Advertisement

spaceman
Joined:
Posts:
13

BTW2:

When going to Tools > Preferences > Storage,
there's the "Append remote path to temporary path" setting there.

I changed it from On to Off, and then retried everything.
(Temp\ folder is clean, with no scp##### folder leftovers).

I edited a file,
and what happened is everything like before, except the sub-folders structure being created.

And again, the scp##### folder could not be deleted after I exit the editor,
despite the fact that the text file was successfully deleted from it,
and the scp##### folder was completely empty of anything.

I changed the seting back to On, so it will be like the default.

Reply with quote

spaceman
Joined:
Posts:
13

There's quite a span between 5.15.9 and 6.3.7. Can you narrow down in what version of WinSCP was the problem introduced?
OK, I did the tests this morning, and here they are.

As you said, there are quite many versions between 5.15.9 and 6.3.7,
so I first started with the 2 edges: 5.15.9, and 6.3.7,
to see if the problem does not occur on 5.15.9 and occurs 6.3.7.

Indeed that's what happened.
So results are consistent with what I had.

I then continued, and here's what I found:
  • 5.15.9 ------ runs well, problem does not occur
  • 6.1.2 ------- runs well, problem does not occur
  • 6.2.beta --- doesn't run on XP
  • 6.3 ---------- doesn't run on XP
  • 6.3.1 ------- doesn't run on XP
  • 6.3.2 ------- problem occurs
  • 6.3.3 ------- problem occurs
As can be seen, there's the 6.2.beta till 6.3.1 gap, in which WinSCP does not run on XP.
Up until that span of versions, the problem does not occur.
And since 6.3.2, which back again runs on XP, the problem occurs.

I hope this helps..

If you need more info, please tell me.

Reply with quote

martin
Site Admin
martin avatar

I have sent you an email with a debug version of WinSCP to the address you have used to register on this forum.

Reply with quote

Advertisement

You can post new topics in this forum