From: simmy on
Hi
I have a problem with the copyhere
I attach my script:

Option Explicit
Dim FileCopy, Source, Dest, ProgressBar
Const FOF_NOCONFIRMATION=&H10
Set ProgressBar = CreateObject("Shell.Application")
Source = "d:\da\*.*"
Dest = "D:\a\"
ProgressBar.Namespace(Dest).CopyHere Source, FOF_NOCONFIRMATION
Set ProgressBar = Nothing ' clean up

My problem is, that i alway received the prompt that ask me if i want
overwrite the files.
How i have to modify my script to alway overwrite the file in the
target directory

Thanx
Simone

From: Fosco on
"simmy"
>My problem is, that i alway received the prompt that ask me if i want
> overwrite the files.


CopyFile Method
Applies To: FileSystemObject Object
Language

VBScript

Show All
Copies one or more files from one location to another.

object.CopyFile ( source, destination[, overwrite] )
Arguments
object
Required. The object is always the name of a FileSystemObject.
source
Required. Character string file specification, which can include wildcard characters, for one or more files to be
copied.
destination
Required. Character string destination where the file or files from source are to be copied. Wildcard characters are not
allowed.
overwrite
Optional. Boolean value that indicates if existing files are to be overwritten. If true, files are overwritten; if
false, they are not. The default is true. Note that CopyFile will fail if destination has the read-only attribute set,
regardless of the value of overwrite.
Remarks
Wildcard characters can only be used in the last path component of the source argument. For example, you can use:

[VBScript]
FileSystemObject.CopyFile "c:\mydocuments\*\R1???97.xls", "c:\tempfolder"
If source contains wildcard characters or destination ends with a path separator (\), it is assumed that destination is
an existing folder in which to copy matching files. Otherwise, destination is assumed to be the name of a file to
create. In either case, three things can happen when an individual file is copied.

If destination does not exist, source gets copied. This is the usual case.
If destination is an existing file, an error occurs if overwrite is false. Otherwise, an attempt is made to copy source
over the existing file.
If destination is a directory, an error occurs.
An error also occurs if a source using wildcard characters doesn't match any files. The CopyFile method stops on the
first error it encounters. No attempt is made to roll back or undo any changes made before an error occurs.

Download the Script56.chm click here :
http://download.microsoft.com/download/winscript56/Install/5.6/W982KMeXP/EN-US/scrdoc56en.exe

snip : http://snipurl.com/jtut
--
Fosco




From: Fosco on
"simmy"
> I have a problem with the copyhere


Set ProgressBar = CreateObject("Shell.Application")
Source = "c:\source\*.*"
Dest = "c:\dest\"
ProgressBar.Namespace(Dest).CopyHere Source, 16

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/objects/folder/copyher
e.asp

snip : http://snipurl.com/k4id

--
Fosco