473,569 Members | 2,542 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why does fso.MoveFolder fail with "Permission denied"?

Why am I getting: "Error Number 70: Permission denied" when trying to move a
folder with the Microsoft Scripting Runtime?

Is there some security setting I don't know about?

Platform: Windows XP SP2 / Access 2003

Private Sub MoveFolder(strD estination As String)
'required references:
'Microsoft Office 11.0 Object Library
'Microsoft Scripting Runtime

Dim dlg As Office.FileDial og
Dim fso As Scripting.FileS ystemObject
Dim varFldr As Variant

Set fso = New FileSystemObjec t
Set dlg = FileDialog(msoF ileDialogFolder Picker)

'open folder picker dialog
dlg.AllowMultiS elect = False
If dlg.Show = True Then
For Each varFldr In dlg.SelectedIte ms
strSource = varFldr
Next

Debug.Print strSource & " => " & strDestination
'the paths look fine...

'move folder and its contents
If Len(strDestinat ion) Then
fso.MoveFolder strSource, strDestination 'ERROR HERE
End If
End If

Set fso = Nothing
Set dlg = Nothing
End Sub

Is there a problem with this code or is it an OS issue?

Thanks in advance.

Jan 10 '06 #1
2 13155
Is there a possibility the account this database is running under does
not have write/modify permissions to either the source or destination
folders (or one level above)? It is my understanding that the
MoveFolder operation mimics a cut 'n' paste operation, which first
copies the object to the destination folder and then deletes it from
the source folder. The account needs to have permissions to delete the
source folder and modify the folder containing it, and permissions to
modify/write to the folder containing the destination folder.

Jan 10 '06 #2

"Steve" <th*********@gm ail.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
Is there a possibility the account this database is running under does
not have write/modify permissions to either the source or destination
folders (or one level above)? It is my understanding that the
MoveFolder operation mimics a cut 'n' paste operation, which first
copies the object to the destination folder and then deletes it from
the source folder. The account needs to have permissions to delete the
source folder and modify the folder containing it, and permissions to
modify/write to the folder containing the destination folder.


But I can move files. Cut and paste these two functions into a standard
module and test from the immediate window with something like:

?MoveTheseFiles To("C:\NewFolde r1\")
(select any file from the dialog - NewFolder1 must exist)

and

?MoveThisFolder To("C:\NewFolde r2\")
(select any folder from the dialog - NewFolder2 must exist)

You'll get the same results - files get moved no problem, but folders get
hung up on "Error Number 70: Permission denied"

Public Function MoveTheseDocume ntsTo(strDestin ation As String)
'required references:
'Microsoft Office 11.0 Object Library
'Microsoft Scripting Runtime

Dim varFile as Variant
Dim dlg As Office.FileDial og
Dim fso As Scripting.FileS ystemObject
Set fso = New Scripting.FileS ystemObject
Set dlg = FileDialog(msoF ileDialogFilePi cker)

strDestination = strDestination & varFile
If dlg.Show = True Then
For Each varFile In dlg.SelectedIte ms
fso.MoveFile varFile, strDestination
Next
End If

Set dlg = Nothing
Set fso = Nothing

End Function

Public Function MoveThisFolderT o(strDestinatio n As String)
'required references:
'Microsoft Office 11.0 Object Library
'Microsoft Scripting Runtime

Dim strSource as String
Dim dlg As Office.FileDial og
Dim fso As Scripting.FileS ystemObject
Dim varFldr As Variant

Set fso = New FileSystemObjec t
Set dlg = FileDialog(msoF ileDialogFolder Picker)

'open folder picker dialog
dlg.AllowMultiS elect = False
If dlg.Show = True Then
For Each varFldr In dlg.SelectedIte ms
strSource = varFldr
Next

Debug.Print strSource & " => " & strDestination
'the paths look fine...

'move folder and its contents
If Len(strDestinat ion) Then
fso.MoveFolder strSource, strDestination 'ERROR HERE
End If
End If

Set fso = Nothing
Set dlg = Nothing

End Function
Jan 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
19143
by: Yitzhak | last post by:
I am having "Permission denied" error while calling LogEvent method of WScript.Shell component. Basically, ASP page calls Windows Script Host Shell component to log events to the OS Application Event log. My environment: Windows Server 2003, IIS 6, WSH, Classic ASP, Vbscript Below is the code and the error: Code:
1
4445
by: Elie Grouchko | last post by:
Hi I am trying to shutdown a COM+ application from an ASP page implemented using VBScript. I get: Err.Number=0x46 Err.Source=Microsoft VBScript runtime error Err.Description=Permission denied
2
14932
by: John Mack | last post by:
Intermittently I get the following error on Firefox: "Error: uncaught exception: Permission denied to get property HTMLDocument.window" What can cause this error? I do an image switch via JS just before redirecting the page (also via JS), could this be the problem - not giving enough time to do the image switch before redirecting? ...
1
4312
by: Mark E. Hamilton | last post by:
Sorry, I probably should have re-stated the problem: We're using Python 2.3.5 on AIX 5.2, and get the follow error messages from some of our code. I haven't yet tracked down exactly where it's coming from: sem_trywait: Permission denied sem_wait: Permission denied sem_post: Permission denied
12
2953
by: Vlad de Mille IV | last post by:
Well, as the subject says.... Briefly, when I try to run *any* wizard, I get a simple dialog, stating "Permission Denied", to which I can only click "OK". I suspect this is a windows (XP) problem rather than an actual Access one, as the error only occurs in my power user (and any other) account. It goes away if I am logged on (to windows)...
3
3510
by: FD | last post by:
A COM was used in VBscript and worked fine. Now I try to use C# to call it with following code: Type myType = Type.GetTypeFromProgID("MyProgID"); object myObj = Activator.CreateInstance(myType); Object myResult = myType.InvokeMember("MyFunction", BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic |...
1
7157
by: Jake Barnes | last post by:
I can not figure out the meaning of this error: Error: " nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame :: http://www.bluecasts.com/pdsIncludes/pdsAjax.js :: submitAnyForm :: line 635" data: no] Source File: http://www.bluecasts.com/pdsIncludes/pdsAjax.js Line: 635
4
9755
by: Russell Warren | last post by:
I've been having a hard time tracking down a very intermittent problem where I get a "permission denied" error when trying to rename a file to something that has just been deleted (on win32). The code snippet that gets repeatedly called is here: ... if os.path.exists(oldPath): os.remove(oldPath) os.rename(newPath, oldPath)
0
1703
by: shriyer | last post by:
Hey.. , when i try single stepping through the code, after a long time, it abruptly gives the error message .." permission denied ".. ??? what is it for? If i run it without singlestep, it gives a sigint at diff points in the program... If it were to be in an endless loop, why would it spit " permission denied" shrikant
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8125
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.