|
-
May 24th, 2002, 04:28 AM
#1
Thread Starter
Addicted Member
(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
Last edited by vbBoy; May 28th, 2002 at 01:34 AM.
-
May 24th, 2002, 04:42 AM
#2
Member
dunno, but
Code:
Kill "\\anything\\dir1\\myfile.txt"
FileSystem.RmDir "\\anything\\dir1"
might work.
-
May 24th, 2002, 04:55 AM
#3
Thread Starter
Addicted Member
Thanks for reply Quix..
I did try that also. but it did not work.
vbBoy
-
May 24th, 2002, 04:58 AM
#4
Thread Starter
Addicted Member
I prefer using the FSO because if the file is flagged read only, the "Kill" or "RmDir" command will return an error.
-
May 24th, 2002, 05:20 AM
#5
Member
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
-
May 24th, 2002, 06:12 AM
#6
Thread Starter
Addicted Member
I will try it when I get home. I don't have a win9x computer here.
thanks
vbBOy
-
May 27th, 2002, 01:13 AM
#7
Thread Starter
Addicted Member
Quix.....
It still does not work on Windows 9x computers. It works only on files and folders located on the local computer and not on files and folders located on the network.
For NT/2K it works fine for local or network files. Do you have any other ideas for me?
Thanks
vbBoy
-
May 27th, 2002, 02:44 AM
#8
Member
Your code works fine on my WIN98 SE machines.
HAHK is the remote PC's name.
VB Code:
Private Sub Command1_Click()
Dim fs, f, f1, sf
Dim strRemoteFolderPath As String
strRemoteFolderPath = "\\Hahk\d\todel"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(strRemoteFolderPath)
Set sf = f.Files
For Each f1 In sf
If f1.Name <> "" Then
f1.Delete True
End If
Next
End Sub
A picture is worth a thousand words...and uses up a thousand times the memory.
- essaar
-
May 28th, 2002, 01:33 AM
#9
Thread Starter
Addicted Member
Thanks for all your replies Guys...
I have resolved it. It was an access rights problem.
vbBoy
-
Nov 7th, 2006, 10:32 AM
#10
New Member
Re: (Resolved)...Delete a shared file or folders (Win9x)
 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)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|