Hi,
I want to save all Files with the name 'test.html' on my client. Unfortunaly there are several files with the same name on the pc.

So I want to save these files with 'test1.html', 'test2.html' and so on.

If I run the script again and a file with the name 'test1.html' or 'test2.html' etc. already exist, the script should carry on with 'test3.html', ...

I use this code provided by MCA
code:
  
$search_key="c:\*.pst"
$server="x:\outlook" ; <== destination directory on your server.
; ; <== it can be also something like "\\server\share"
;
IF (Exist("%temp%\kixtart.tmp") = 1)
DEL %temp%\kixtart.tmp
ENDIF
SHELL "%comspec% /e:1024 /c dir "+$search_key+" /a /b /s >%temp%\kixtart.tmp"
SHELL "%comspec% /e:1024 /c echo -end.of.list- >>%temp%\kixtart.tmp"
IF (Exist ("%temp%\kixtart.tmp") = 1)
IF Open(1,"%temp%\kixtart.tmp")
ENDIF
$found="no"
$count=0
WHILE ($found = "no")
$result=ReadLine(1)
IF (@error <> 0) OR (InStr($result,"-end.of.list-") <> 0)
$found="yes"
ELSE
$count=$count+1
? Substr("$count"+" ",1,4)+" "+$result+" ("+GetFileSize($result)+" bytes "+GetFileTime($result)+")"
IF Open(2, $result)
ENDIF
; - your actions on this file
GOSUB additional_actions
IF Close(2)
ENDIF
ENDIF
LOOP
IF Close(1)
ENDIF
IF ($count <> 0)
? "Informative KIX: "+$count+" files found with key '"+$search_key+"'."
ELSE
? "Warning KIX: no files found with key '"+$search_key+"'."
ENDIF
ENDIF
DEL %temp%\kixtart.tmp
EXIT
:additional_actions
IF (Substr($server,Len($server),1) = "\")
$server=Substr($server,1,Len($server)-1)
ENDIF
IF ($count > 1)
$destination=$server+"\"+@userid+"_"+$count+".pst"
ELSE
$destination=$server+"\"+@userid+".pst"
ENDIF
? "Info: copy '"+Lcase($result)+"' ("+GetFileSize($result)+" bytes)"
COPY $result $destination /h
IF (@error <> 0)
? "Warning: error @error (@serror)"
ENDIF
RETURN

In this case the files will be overwriten if existent. How must I modify the script to fit my task?

Regards
Mike