Trying to move edi backup files that start with "@" symbol from one
server to another server same domain: See code

Option Explicit

Dim fso
Dim objFolderSource
Dim objFolderDestination
Dim colFiles
Dim objFile
Dim strSourceDir
Dim strDestinationDir
Dim ArchiveDate
Dim starttime

strSourceDir = "\\server1\c$\q32w"
strDestinationDir = "\\server2\d$\QualediBackup"
starttime = now()
ArchiveDate = dateadd("m",-2,Now())

'Copy files from source to destination
Set fso = CreateObject("Scripting.FileSystemObject")
Set objFolderSource = fso.GetFolder(strSourceDir)
Set colFiles = objFolderSource.Files

For each objFile in colFiles
'msgbox objFile.Name & " - " & objFile.DateLastModified

If Left(objFile.name, 1) = "@" Then
objFile.Copy (strDestinationDir)
End If
Next

'clean up
set fso = nothing
set objFolderSource = nothing
set objFolderDestination = nothing

When script runs I get a Permission denied error. Any ideas? Is my code
wrong?

Re: Move files from one server to another server (same domain) by James

James
Wed Dec 28 09:46:54 CST 2005

"mike" <m.wilson78@gmail.com> wrote in message
news:1135783989.220716.318460@o13g2000cwo.googlegroups.com...
>
> strDestinationDir = "\\server2\d$\QualediBackup"
> [...]
> When script runs I get a Permission denied error. Any ideas? Is my code
> wrong?

Try adding a backslash to the end of your destination folder:

strDestinationDir = "\\server2\d$\QualediBackup\"




Re: Move files from one server to another server (same domain) by mike

mike
Wed Dec 28 11:41:05 CST 2005

Yes it works, thanks. However not all files are being copied.


Re: Move files from one server to another server (same domain) by James

James
Wed Dec 28 12:20:19 CST 2005

"mike" <m.wilson78@gmail.com> wrote in message
news:1135791665.746140.276080@g44g2000cwa.googlegroups.com...
> Yes it works, thanks. However not all files are being copied.

You have files beginning with "@" are not being copied? Is it possible
that the files are in use & therefore locked? Is there a pattern to the
files not being copied? Does the destination contain a file with the same
name that is read-only?

If it does not pose a security risk to you or your company, post a
directory listing of the files and indicate which files did not get copied.
Maybe someone in the group can spot a pattern or a reason why these files
are not being copied.