473,395 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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(strDestination As String)
'required references:
'Microsoft Office 11.0 Object Library
'Microsoft Scripting Runtime

Dim dlg As Office.FileDialog
Dim fso As Scripting.FileSystemObject
Dim varFldr As Variant

Set fso = New FileSystemObject
Set dlg = FileDialog(msoFileDialogFolderPicker)

'open folder picker dialog
dlg.AllowMultiSelect = False
If dlg.Show = True Then
For Each varFldr In dlg.SelectedItems
strSource = varFldr
Next

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

'move folder and its contents
If Len(strDestination) 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 13135
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*********@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.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:

?MoveTheseFilesTo("C:\NewFolder1\")
(select any file from the dialog - NewFolder1 must exist)

and

?MoveThisFolderTo("C:\NewFolder2\")
(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 MoveTheseDocumentsTo(strDestination As String)
'required references:
'Microsoft Office 11.0 Object Library
'Microsoft Scripting Runtime

Dim varFile as Variant
Dim dlg As Office.FileDialog
Dim fso As Scripting.FileSystemObject
Set fso = New Scripting.FileSystemObject
Set dlg = FileDialog(msoFileDialogFilePicker)

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

Set dlg = Nothing
Set fso = Nothing

End Function

Public Function MoveThisFolderTo(strDestination As String)
'required references:
'Microsoft Office 11.0 Object Library
'Microsoft Scripting Runtime

Dim strSource as String
Dim dlg As Office.FileDialog
Dim fso As Scripting.FileSystemObject
Dim varFldr As Variant

Set fso = New FileSystemObject
Set dlg = FileDialog(msoFileDialogFolderPicker)

'open folder picker dialog
dlg.AllowMultiSelect = False
If dlg.Show = True Then
For Each varFldr In dlg.SelectedItems
strSource = varFldr
Next

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

'move folder and its contents
If Len(strDestination) 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
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...
1
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...
2
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...
1
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...
12
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)...
3
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);...
1
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 ::...
4
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). ...
0
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.