"Philip Tattersall" <philip@xxxxxx> wrote in message
news:esPQYIwHJHA.3736@xxxxxx
Quote:
>
> I am trying to copy a file from a location on a server into the
> following directory on local pc's
> C:\Documents and Settings\All Users\Application Data
>
> I can copy the file with no trouble to c:\Documents and Settings.
> However I get a permission denied error code 800a0046 message and the
> script fails when trying o copy to
> C:\Documents and Settings\All Users\Application Data.
>
> The code I'm using is below. Any suggestions would be much appreciated.
>
> Dim FSO
>
> Set FSO = CreateObject("Scripting.FileSystemObject")
>
> FSO.CopyFile "z:\scripts\test.txt", "C:\Documents and Settings\All
> Users\Application Data"
You need to add a backslash to the end of your destination so that it
knows it is a directory. As written, it is trying to copy 'test.txt' to
'C:\Documents and Settings\All Users' with a filename of 'Application Data'.
The error is a result of there already being a folder with that name in the
directory.