Solved

closing a 'pipeline' (open connection to a server share) from VBSCRIPT

Posted on 2004-09-10
4
228 Views
Last Modified: 2010-05-02
Hi all,

I have a problem with a script.
When I copy data from a server share and then delete the share I receive the error:

Err ID: 46 "Permission Denied"

This happens when copying and deleting is done in the same run of the script.

But when I run the script copy, don't delete it works fine
and
when I run the script don't copy/delete it works fine also.

But I want both functions into one run of the script. It looks to me there is still a connection (from the copying) which is not closed, that maybe the reason I receive the error.

I do have enough permissions to copy/delete etc from the server share.

A summary of the code:
==========

<object id="objFSO"             progid="Scripting.FileSystemObject"/>


Set TestFolder = objFSO.GetFolder("\\" & strServernaam & "\" & testfolder) 'This is correct!
IF Err.Number <> 0 THEN
   tsLogFile.WriteLine "    [DeleteShare] ERROR: Error ID: " & Hex(Err.Number) & " " & Err.Description            
   err.clear
ELSE
   err.clear
   TestFolder.Delete
    IF Err.Number <> 0 THEN
      tsLogFile.WriteLine "    [DeleteShare] ERROR: share could not be deleted. Error ID:" & Hex(Err.Number) & " " & Err.Description
    ELSE
      tsLogFile.WriteLine "    [DeleteShare] Success: share succesfully deleted"
   END IF
END IF

==========

The error occurs after the testfolder.delete command. When I put a SLEEP 60000 command before deleting (maybe it needs some time for closing the connection) it does not matter.

Any help? I'm thinking of an open connection... but how to close... Thanks!

Best Regards,

P. Keizer
(the Netherlands)

0
Comment
Question by:keizerpiet
4 Comments
 
LVL 26

Expert Comment

by:EDDYKT
ID: 12029364
Set TestFolder = nothing

and then reopen by using

Set TestFolder = objFSO.GetFolder("\\" & strServernaam & "\" & testfolder) 'This is correct!


?
0
 
LVL 19

Accepted Solution

by:
RanjeetRain earned 500 total points
ID: 12029756
That approach is not likely to work.

MAP the share as a Network work drive and UNMAP after you are done.
0
 

Author Comment

by:keizerpiet
ID: 12042207
the Set Nothing does not work all the time.... I keep something the Permission Denied error.

Mapping could work, but we are not allowed to map drive unfortunately.

Is there a way by viewing active 'pipes' or access made to a drive/folder?

Thanks for the replies so far!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB error "Type mismatch" 2 60
I need help using System.Web.HttpUtility.HtmlEncode in my VB.Net application 3 94
Automatic Email Reminder 4 57
Problem to line 23 53
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question