[RESOLVED] "Permission Denied" when copy folder
vb Code:
Private Sub CopyFile()
Dim fsObject As FileSystemObject
Set fsObject = New FileSystemObject
fsObject.CopyFolder "\\serverName\SPPS\pKCb\Reports", "c:\SPPS\pKCb\", True
Set fsObject = Nothing
End Sub
Hi All,
Above is my code that hitting error when I'm trying to copy over one of the folder from server to client PC. The error message is "Permission Denied (70)"
Anyone can guide me to resolve my problem?
Thanks a million.
Re: "Permission Denied" when copy folder
Are you able to manually copy that folder using Windows explorer?
Re: "Permission Denied" when copy folder
Quote:
Originally Posted by
DigiRev
Are you able to manually copy that folder using Windows explorer?
Yes, I had tried it.
is it system ask permission to overwrite the file encountered permission issue?
Re: "Permission Denied" when copy folder
Yes you don't have permissions to write to "c:\SPPS\pKCb\" but I wouldn't be surprised if you create a folder on your desktop and supply that path as the destination folder. Sometimes only the Desktop is left unlocked... like in my company :p
Re: "Permission Denied" when copy folder
Quote:
Originally Posted by
koolsid
Yes you don't have permissions to write to "c:\SPPS\pKCb\" but I wouldn't be surprised if you create a folder on your desktop and supply that path as the destination folder. Sometimes only the Desktop is left unlocked... like in my company :p
I think lock is not the issue in my situation because I still can overwrite the file once I was clicked on Yes button hehe....
Any suggestion or solution to resolve my problem :(
Re: "Permission Denied" when copy folder
How about deleting everything in the folder before making a new copy of it?
Re: "Permission Denied" when copy folder
You could solve this by two ways. One thing is this
1.Check that the folder exits or not using FolderExists Method.If exist delete it and copy it.
2. Or use the overwrite attribute to true
Quote:
object.CopyFolder ( source, destination[, overwrite] );
Refer : MSDN
Re: "Permission Denied" when copy folder
Thanks Hack and danasegarane,
The problem was rectified by checking folder exist. If folder exist then delete the folder and making the new copy of it.