(Resolved)...Delete a shared file or folders (Win9x)
Hello,
Can anybody help me on how to delete a file or folder on the network using Windows 9x. I tried with the code below but it did not work. It works perfectly on WinNT or Win2k.
Code:
Dim fs, f, f1, sf
Dim strRemoteFolderPath as String
strRemoteFolderPath = txtPathName.Text
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(strRemoteFolderPath)
Set sf = f.Files
For Each f1 In sf
if f1.Name = txtFileName.Text then
f1.Delete True
end if
next
'End code
Any help will be appreciated
vbBoy
how about the api-functions?
Code:
Public Declare Function RemoveDirectory Lib "kernel32" Alias "RemoveDirectoryA" (ByVal lpPathName As String) As Long
Public Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" (ByVal lpFileName As String) As Long
Re: (Resolved)...Delete a shared file or folders (Win9x)
Quote:
Originally Posted by vbBoy
I prefer using the FSO because if the file is flagged read only, the "Kill" or "RmDir" command will return an error.
This was my problem! I didn't know that the read-only attribute was making kill return an error of 75 - File/path access error.
If going that route and wanting to use Kill, first do SetAttr(strFile, vbNormal)