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
if fso.fileExsists(newydd & "\" & ffeil.name) then
set ffeilgwreiddiol = fso.GetFile(ffeil.path)
set ffeilnewydd = fso.GetFile(newydd & "\" & ffeil.name)
if ffeilgwreiddiol.size <> ffeilnewydd.size then
'on error resume next
fso.copyFile ffeil.path, newydd
if ffeilgwreiddiol.size <> ffeilnewydd.size then
'A prob happened objXL.Cells(NiferOFfolderi+13+countErrors, 2).Value = ffeil.path
countErrors = countErrors+1
else
'file copied ok
end if
else
'file copied ok
end if
else
'A prob happened
objXL.Cells(NiferOFfolderi+13+countErrors, 2).Value = ffeil.path
countErrors = countErrors+1
end if
next
for each isffolder in ffolderGwreiddiol.SubFolders
call copioffolder (isffolder.path, newydd & "\" & isffolder.name)
next
end function
Sorry about var names - Welsh i'm afraid!
Thanks in advance
A computer always does what you tell it to, but rarely does what you want it to.....
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
if fso.fileExsists(newydd & "\" & ffeil.name) then
set ffeilgwreiddiol = fso.GetFile(ffeil.path)
set ffeilnewydd = fso.GetFile(newydd & "\" & ffeil.name)
if ffeilgwreiddiol.size <> ffeilnewydd.size then
'on error resume next
fso.copyFile ffeil.path, newydd
if ffeilgwreiddiol.size <> ffeilnewydd.size then
'A prob happened objXL.Cells(NiferOFfolderi+13+countErrors, 2).Value = ffeil.path
countErrors = countErrors+1
else
'file copied ok
end if
else
'file copied ok
end if
else
'A prob happened
objXL.Cells(NiferOFfolderi+13+countErrors, 2).Value = ffeil.path
countErrors = countErrors+1
end if
next
for each isffolder in ffolderGwreiddiol.SubFolders
call copioffolder (isffolder.path, newydd & "\" & isffolder.name)
next
end function
Sorry about var names - Welsh i'm afraid!
Thanks in advance
A computer always does what you tell it to, but rarely does what you want it to.....