Permission Denied on fso.CopyFile

Permission Denied on fso.CopyFile

Permission Denied on fso.CopyFile

I am programming a script that will backup files from the server onto another computer on the network - simple stuff really (well, it was supposed to be!).

I am copying a shared folder off the server by running my own function to copy it - e.g.

call myCopyFunction ("\\server\folder", "c:\backup")

I was getting an error message - Permission Denied on the copyfile lines so i thought it was a one-off with a file, so I added an On error resume next. Problem is, there must be an error with copying every file, because no file is copied, but the dir tree is copied.

The permissions on the server seem to be ok - Everyone is Full! I can copy files manually from that folder to my pc. Any ideas? Here's the function:

function copioffolder(gwreiddiol, newydd) set ffolderGwreiddiol = fso.GetFolder(gwreiddiol) if fso.FolderExists(newydd) then else fso.CreateFolder (newydd) end if

for each ffeil in ffolderGwreiddiol.Files fso.copyFile ffeil.path, newydd

[2.3] This may be just editing mishap. Newline is needed.>'A prob happened objXL.Cells(NiferOFfolderi+13+countErrors, 2).Value = ffeil.path

[3] Do you have reason you fear that the file not being copied? Even so, you should leave sufficient time lapse for the copy to complete. Hence, the structure like this>> fso.copyFile ffeil.path, newydd & "\">> if fso.fileExists(newydd & "\" & ffeil.name) thenis problematic. I would rather have a loop to ascertain it like this.

RE: Permission Denied on fso.CopyFile

But, that is always a case you should look into. Either destination already exists and is readonly---then you should delete the destination or change the readonly attribute. If for some other reason, you have to study it why.

RE: Permission Denied on fso.CopyFile

with regards to the loop and sleep i have never come across a need for one with regards to a file copy.personally i would avoid a Sleep in a script like the plague and even more so a Loop which contains one

i know i am on a soap box mission this week but.,.

by the nature of what a Function is the ultimate goal is that it can be re-used again and again in other scripts etc if needed. therefore i would say it would be good programming practice to make sure it can handle any length of folder depth so to speak.

RE: Permission Denied on fso.CopyFile

mrmovie, it is I who feel sorry. A quick test on this does reveal .fileexists() can be determined probably from the memory(?), even the same for the file.size data. So you're right. My apology! I take back the observation.

It is the attempt to open it (for instance, using .run "notepad " & file.path) which poses problem. That I have to wait (sleep). Hence, the surrender of the control to the next script line is done according to the agenda of fso, not physically written to the disk. So I would as well have difficulty to qualify it as synchronously.

Thanks again mrmovie for the counter-opinion which is correct is the context under scrutiny.