Topic "Bug: cannot delete directories on windows server"

Author Message
guest

Guest


On a windows server, when i try to delete a directory I get the following error:


/rootdir/test: The process cannot access the file because it is being used by another process.


Protocol: FTP
Tested on Godaddy Windows Hosting
Advertisements
Greg
[View user's profile]

Joined: 2007-10-04
Posts: 11
guest wrote:
On a windows server, when i try to delete a directory I get the following error:

/rootdir/test: The process cannot access the file because it is being used by another process.
FWIW, I see exactly the same issue. I also can't delete it with another program until I exit WinSCP - it appears WinSCP places some sort of lock on the directory, somehow. Are there any known work-arounds?

Greg
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Greg wrote:
FWIW, I see exactly the same issue. I also can't delete it with another program until I exit WinSCP - it appears WinSCP places some sort of lock on the directory, somehow. Are there any known work-arounds?

What directory it is?
_________________
Martin Prikryl
Greg
[View user's profile]

Joined: 2007-10-04
Posts: 11
prikryl wrote:
Greg wrote:
FWIW, I see exactly the same issue. I also can't delete it with another program until I exit WinSCP - it appears WinSCP places some sort of lock on the directory, somehow. Are there any known work-arounds?

What directory it is?
Any directory. See below for a log where I create a directory, then attempt to delete it.

My analysis: It appears from the log the the client changes the CWD to the directory to check it's empty, then attempts to delete it. It can't delete it because it's also the CWD (the equivalent of "rd ." from the command line, which gives the exact same error). It probably needs to move to the directory above before attempting to delete it.
Code:

. 2007-10-12 16:38:12.625 Creating directory "test".
. 2007-10-12 16:38:12.625 FtpControlSocket.cpp(4857): MakeDir("/********/backup-2007-04-17/test/")  OpMode=0 OpState=-1   caller=0x01d2a95c
> 2007-10-12 16:38:12.625 CWD /********/backup-2007-04-17/
. 2007-10-12 16:38:12.687 FtpControlSocket.cpp(878): OnReceive(0)  OpMode=2048 OpState=0   caller=0x01d2a95c
< 2007-10-12 16:38:12.687 250 CWD command successful.
. 2007-10-12 16:38:12.687 FtpControlSocket.cpp(4857): MakeDir("")  OpMode=2048 OpState=0   caller=0x01d2a95c
> 2007-10-12 16:38:12.687 MKD test
. 2007-10-12 16:38:12.750 FtpControlSocket.cpp(878): OnReceive(0)  OpMode=2048 OpState=2   caller=0x01d2a95c
< 2007-10-12 16:38:12.750 257 "test" directory created.
. 2007-10-12 16:38:12.750 FtpControlSocket.cpp(4857): MakeDir("")  OpMode=2048 OpState=2   caller=0x01d2a95c
. 2007-10-12 16:38:12.750 FtpControlSocket.cpp(4180): ResetOperation(1)  OpMode=2048 OpState=2   caller=0x01d2a95c
. 2007-10-12 16:38:12.750 Got reply 1 to the command 256
. 2007-10-12 16:38:12.750 FtpControlSocket.cpp(1276): List(FALSE,0,"/********/backup-2007-04-17/","",1)  OpMode=0 OpState=-1   caller=0x01d2a95c
. 2007-10-12 16:38:12.750 Retrieving directory listing...
> 2007-10-12 16:38:12.750 TYPE A
. 2007-10-12 16:38:12.766 FtpControlSocket.cpp(878): OnReceive(0)  OpMode=4 OpState=8   caller=0x01d2a95c
< 2007-10-12 16:38:12.766 200 Type set to A.
. 2007-10-12 16:38:12.766 FtpControlSocket.cpp(1276): List(FALSE,0,"","",0)  OpMode=4 OpState=8   caller=0x01d2a95c
> 2007-10-12 16:38:12.766 PORT 10,215,156,222,16,65
. 2007-10-12 16:38:12.797 FtpControlSocket.cpp(878): OnReceive(0)  OpMode=4 OpState=7   caller=0x01d2a95c
< 2007-10-12 16:38:12.797 200 PORT command successful.
. 2007-10-12 16:38:12.797 FtpControlSocket.cpp(1276): List(FALSE,0,"","",0)  OpMode=4 OpState=7   caller=0x01d2a95c
. 2007-10-12 16:38:12.797 TransferSocket.cpp(597): SetActive()   caller=0x01d7ae0c
> 2007-10-12 16:38:12.797 LIST -a
. 2007-10-12 16:38:12.812 FtpControlSocket.cpp(878): OnReceive(0)  OpMode=4 OpState=9   caller=0x01d2a95c
< 2007-10-12 16:38:12.812 150 Opening ASCII mode data connection for /bin/ls.
. 2007-10-12 16:38:12.812 FtpControlSocket.cpp(1276): List(FALSE,0,"","",0)  OpMode=4 OpState=9   caller=0x01d2a95c
. 2007-10-12 16:38:12.828 TransferSocket.cpp(418): OnAccept(0)   caller=0x01d7ae0c
. 2007-10-12 16:38:12.875 TransferSocket.cpp(557): OnClose(0)   caller=0x01d7ae0c
. 2007-10-12 16:38:12.875 TransferSocket.cpp(1179): Close()   caller=0x01d7ae0c
. 2007-10-12 16:38:12.875 TransferSocket.cpp(1179): Close()   caller=0x01d7ae0c
. 2007-10-12 16:38:12.875 FtpControlSocket.cpp(2070): TransferEnd(4)  OpMode=4 OpState=10   caller=0x01d2a95c
. 2007-10-12 16:38:12.875 FtpControlSocket.cpp(1276): List(TRUE,0,"","",0)  OpMode=4 OpState=10   caller=0x01d2a95c
. 2007-10-12 16:38:12.875 10-12-07  03:26PM       <DIR>          ajax
. 2007-10-12 16:38:12.875 10-12-07  04:38PM       <DIR>          test
. 2007-10-12 16:38:12.875 TransferSocket.cpp(108): ~CTransferSocket()   caller=0x01d7ae0c
. 2007-10-12 16:38:12.875 TransferSocket.cpp(1179): Close()   caller=0x01d7ae0c
. 2007-10-12 16:38:12.969 FtpControlSocket.cpp(878): OnReceive(0)  OpMode=4 OpState=10   caller=0x01d2a95c
< 2007-10-12 16:38:12.969 226 Transfer complete.
. 2007-10-12 16:38:12.969 FtpControlSocket.cpp(1276): List(FALSE,0,"","",0)  OpMode=4 OpState=10   caller=0x01d2a95c
. 2007-10-12 16:38:12.969 Directory listing successful
. 2007-10-12 16:38:12.969 FtpControlSocket.cpp(4180): ResetOperation(1)  OpMode=4 OpState=10   caller=0x01d2a95c
. 2007-10-12 16:38:12.969 Got reply 1 to the command 2
. 2007-10-12 16:38:13.000 Session upkeep
. 2007-10-12 16:38:13.078 Session upkeep
. 2007-10-12 16:38:13.578 Session upkeep
. 2007-10-12 16:38:14.078 Session upkeep
. 2007-10-12 16:38:14.578 Session upkeep
. 2007-10-12 16:38:15.078 Session upkeep
. 2007-10-12 16:38:15.578 Session upkeep
. 2007-10-12 16:38:15.750 Deleting file "test".
. 2007-10-12 16:38:15.766 FtpControlSocket.cpp(1276): List(FALSE,0,"/********/backup-2007-04-17/test/","",1)  OpMode=0 OpState=-1   caller=0x01d2a95c
. 2007-10-12 16:38:15.766 Retrieving directory listing...
> 2007-10-12 16:38:15.766 CWD /********/backup-2007-04-17/test/
. 2007-10-12 16:38:15.828 FtpControlSocket.cpp(878): OnReceive(0)  OpMode=4 OpState=1   caller=0x01d2a95c
< 2007-10-12 16:38:15.828 250 CWD command successful.
. 2007-10-12 16:38:15.828 FtpControlSocket.cpp(1276): List(FALSE,0,"","",0)  OpMode=4 OpState=1   caller=0x01d2a95c
> 2007-10-12 16:38:15.828 PWD
. 2007-10-12 16:38:15.844 FtpControlSocket.cpp(878): OnReceive(0)  OpMode=4 OpState=2   caller=0x01d2a95c
< 2007-10-12 16:38:15.844 257 "/********/backup-2007-04-17/test" is current directory.
. 2007-10-12 16:38:15.844 FtpControlSocket.cpp(1276): List(FALSE,0,"","",0)  OpMode=4 OpState=2   caller=0x01d2a95c
> 2007-10-12 16:38:15.844 TYPE A
. 2007-10-12 16:38:15.859 FtpControlSocket.cpp(878): OnReceive(0)  OpMode=4 OpState=8   caller=0x01d2a95c
< 2007-10-12 16:38:15.859 200 Type set to A.
. 2007-10-12 16:38:15.859 FtpControlSocket.cpp(1276): List(FALSE,0,"","",0)  OpMode=4 OpState=8   caller=0x01d2a95c
> 2007-10-12 16:38:15.891 PORT 10,215,156,222,16,67
. 2007-10-12 16:38:15.906 FtpControlSocket.cpp(878): OnReceive(0)  OpMode=4 OpState=7   caller=0x01d2a95c
< 2007-10-12 16:38:15.906 200 PORT command successful.
. 2007-10-12 16:38:15.906 FtpControlSocket.cpp(1276): List(FALSE,0,"","",0)  OpMode=4 OpState=7   caller=0x01d2a95c
. 2007-10-12 16:38:15.906 TransferSocket.cpp(597): SetActive()   caller=0x01d74d64
> 2007-10-12 16:38:15.906 LIST -a
. 2007-10-12 16:38:15.922 FtpControlSocket.cpp(878): OnReceive(0)  OpMode=4 OpState=9   caller=0x01d2a95c
< 2007-10-12 16:38:15.922 150 Opening ASCII mode data connection for /bin/ls.
. 2007-10-12 16:38:15.922 FtpControlSocket.cpp(1276): List(FALSE,0,"","",0)  OpMode=4 OpState=9   caller=0x01d2a95c
. 2007-10-12 16:38:15.937 TransferSocket.cpp(418): OnAccept(0)   caller=0x01d74d64
. 2007-10-12 16:38:15.969 TransferSocket.cpp(557): OnClose(0)   caller=0x01d74d64
. 2007-10-12 16:38:15.969 TransferSocket.cpp(1179): Close()   caller=0x01d74d64
. 2007-10-12 16:38:15.969 TransferSocket.cpp(1179): Close()   caller=0x01d74d64
. 2007-10-12 16:38:15.969 FtpControlSocket.cpp(2070): TransferEnd(4)  OpMode=4 OpState=10   caller=0x01d2a95c
. 2007-10-12 16:38:15.969 FtpControlSocket.cpp(1276): List(TRUE,0,"","",0)  OpMode=4 OpState=10   caller=0x01d2a95c
. 2007-10-12 16:38:15.969 <Empty directory listing>
. 2007-10-12 16:38:15.969 TransferSocket.cpp(108): ~CTransferSocket()   caller=0x01d74d64
. 2007-10-12 16:38:15.969 TransferSocket.cpp(1179): Close()   caller=0x01d74d64
. 2007-10-12 16:38:16.078 FtpControlSocket.cpp(878): OnReceive(0)  OpMode=4 OpState=10   caller=0x01d2a95c
< 2007-10-12 16:38:16.078 226 Transfer complete.
. 2007-10-12 16:38:16.078 FtpControlSocket.cpp(1276): List(FALSE,0,"","",0)  OpMode=4 OpState=10   caller=0x01d2a95c
. 2007-10-12 16:38:16.078 Directory listing successful
. 2007-10-12 16:38:16.078 FtpControlSocket.cpp(4180): ResetOperation(1)  OpMode=4 OpState=10   caller=0x01d2a95c
. 2007-10-12 16:38:16.078 Got reply 1 to the command 2
. 2007-10-12 16:38:16.078 FtpControlSocket.cpp(4473): RemoveDir("test", "/********/backup-2007-04-17/")  OpMode=0 OpState=-1   caller=0x01d2a95c
> 2007-10-12 16:38:16.078 RMD /********/backup-2007-04-17/test/
. 2007-10-12 16:38:16.109 FtpControlSocket.cpp(878): OnReceive(0)  OpMode=512 OpState=-1   caller=0x01d2a95c
< 2007-10-12 16:38:16.109 550 /********/backup-2007-04-17/test: The process cannot access the file because it is being used by another process.
. 2007-10-12 16:38:16.109 FtpControlSocket.cpp(4473): RemoveDir("", "")  OpMode=512 OpState=-1   caller=0x01d2a95c
. 2007-10-12 16:38:16.109 FtpControlSocket.cpp(4180): ResetOperation(4)  OpMode=512 OpState=-1   caller=0x01d2a95c
. 2007-10-12 16:38:16.109 Got reply 4 to the command 64
. 2007-10-12 16:38:16.109 Asking user:
. 2007-10-12 16:38:16.109 Error deleting file 'test'. ("/********/backup-2007-04-17/test: The process cannot access the file because it is being used by another process. ")
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Greg wrote:
My analysis: It appears from the log the the client changes the CWD to the directory to check it's empty, then attempts to delete it. It can't delete it because it's also the CWD (the equivalent of "rd ." from the command line, which gives the exact same error). It probably needs to move to the directory above before attempting to delete it.

Good point, thanks. That's quite probable. I will fix that. BTW, what FTP server are you using? Because I do not have the problem with others.
_________________
Martin Prikryl
Greg
[View user's profile]

Joined: 2007-10-04
Posts: 11
prikryl wrote:
Greg wrote:
My analysis: It appears from the log the the client changes the CWD to the directory to check it's empty, then attempts to delete it. It can't delete it because it's also the CWD (the equivalent of "rd ." from the command line, which gives the exact same error). It probably needs to move to the directory above before attempting to delete it.

Good point, thanks. That's quite probable. I will fix that.

Just tried with the latest version, 4.0.6, and that can now successfully delete directories whereas before I couldn't. So many thanks for the update!

Greg
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License