Permission Denied After Calling ListDir - WeOnlyDo Discussion board

Permission Denied After Calling ListDir (wodFtpDLX / wodFtpDLX.NET)

by Roy, Tuesday, March 08, 2005, 20:28 (6987 days ago)

Hello,

I can connect to the server, remove a directory, and disconnect.

If I connect, call FTP1.ListDir, display the files if any, then try to remove directory, I get a Permission Denied message. I have checked that there are NO files in the directory, and I can remove the directory if I don't call FTP1.ListDir. Also, I am waiting for the FTP1.StateText to say Connected...: Idle . What am I doing wrong?

Re: Permission Denied After Calling ListDir

by wodSupport, Tuesday, March 08, 2005, 20:44 (6987 days ago) @ Roy

Roy,

do you use full paths at all times?

If server returns 'permission denied', there's not much you can do from the client side. But, can you paste some code to see how you do it? Do you use blocking mode?

Re: Permission Denied After Calling ListDir

by Roy, Tuesday, March 08, 2005, 21:30 (6987 days ago) @ wodSupport

Here is some of the pertinent code...

'Connecting to Server...

Private Sub Command1_Click()

FTP1.Blocking = True
FTP1.Protocol = FTPSwithdata

On Error GoTo ErrorHandler
FTP1.Connect

Text1.Text = Connected
Exit Sub

ErrorHandler:

If Err.Number <> 0 Then 'Succes
msgbox Connected
End If

End Sub

'Looking for Remote Directory, Creating if it doesn't exist

Private Function CheckSwitchRemoteDir()

On Error Resume Next

If bConnected Then

FTP1.CheckDir CustomerJobsSomeSubFolder 'Root Directory = CustomerJobs

If Err.Number = 40550 Then 'Directory Does Not Exist
CheckSwitchRemoteDir = False
FTP1.MakeDir CustomerJobsSomeSubFolder

If FTP1.RemotePath = CustomerJobsSomeSubFolder Then
CheckSwitchRemoteDir = True
Else
CheckSwitchRemoteDir = False
End If

ElseIf Err.Number = 0 Then 'Directory Exist
CheckSwitchRemoteDir = True
End If

End If

End Sub

'Listing Directory

Private Sub Command3_Click()
FTP1.ListDir
End Sub

'Removing Directory
Private Sub Command6_Click()
FTP1.RemoveDir CustomerJobsSomeSubFolder
End Sub

'Adding Folder Contents to Text1.text
Private Sub FTP1_Done(ByVal ErrorCode As Long, ByVal ErrorText As String)

Dim iLoop As Integer

'Some logic to make sure this only runs after ListDir...

If bListDir then
If FTP1.DirItems.Count > 0 Then

For iLoop = 0 To FTP1.DirItems.Count - 1
Text4.Text = Text4.Text & FTP1.DirItems(iLoop).name & vbCrLf
Next iLoop

End If
End If

End Sub

'*********************************************************
I have tried with Blocking on and off...

I have tried FTP1.Abort in between ListDir and RemoveDir...

I have also tried the same process in an off the shelf FTP client (CuteFTP Pro) and it works fine. Problem doesn't appear to be the server...

I only seem to get this error after I call ListDir...

Re: Permission Denied After Calling ListDir

by wodSupport, Tuesday, March 08, 2005, 21:32 (6987 days ago) @ Roy

Roy,

I see you don't use full paths. Can you try using them? Something like

/home/joe/something

Re: Permission Denied After Calling ListDir

by Roy, Tuesday, March 08, 2005, 21:43 (6987 days ago) @ wodSupport

Hi,

I do use full paths, the slahes get parsed out of this forum...

Root Directory on server: Customer / Jobs

When using MakerDir: Customer / Jobs / SomeSomeFolder

When using RemoveDir: Customer / Jobs / SomeSubFolder

Re: Permission Denied After Calling ListDir

by Roy, Tuesday, March 08, 2005, 21:44 (6987 days ago) @ Roy

OK, so the slashes didn't get parsed out that time... Ignore the spaces in between the directory info...

Re: Permission Denied After Calling ListDir

by wodSupport, Tuesday, March 08, 2005, 21:52 (6987 days ago) @ Roy

Roy,

but Customer / Jobs doesn't look like full path to me.

/Customer/Jobs (start with slash) would be...

Re: Permission Denied After Calling ListDir

by Roy, Tuesday, March 08, 2005, 21:56 (6987 days ago) @ wodSupport

Sorry, I HAVE been using the leading /, just didn't put it in the forum.

All request have looked like this...

/Customer/Jobs.SomeSubFolder

I have also tried

/Customer/Jobs.SomeSubFolder

That is not the issue Everything works fine if I DON'T call ListDir...

Re: Permission Denied After Calling ListDir

by Roy, Tuesday, March 08, 2005, 21:57 (6987 days ago) @ Roy

This is frustrating...

correct last statement to...

/Customer/Jobs/SomeSubFolder

Re: Permission Denied After Calling ListDir

by wodSupport, Tuesday, March 08, 2005, 22:01 (6987 days ago) @ Roy

Roy,

any chance you can set me up test or guest account on that server so I can try? If so, please send details to techsupport@weonlydo.com so I can try it out. Hopefully that will tell me what's going on.

Re: Permission Denied After Calling ListDir

by wodSupport, Tuesday, March 08, 2005, 22:36 (6987 days ago) @ wodSupport

Just if anyone is interested - we found the problem. Seems that wodFtpDLX is sitting in the folder it tries to remove. Doing CheckDir (parent) helped.

We'll try to fix it so it does this automatically in the future.

Yes, it is sort of bug :)