in VB you can do this:
Imports System
Imports System.IO
Module Module1
Sub Main()
Dim path As String = "c:\temp\filetocopy.txt" ' put the file you
want to copy here
If File.Exists(path) = True Then
Try
Dim path2 As String = "c:\temp\thecopiedfile.txt" ' put
where you want the file copied here
' Ensure that the target does not exist.
File.Delete(path2)
' Copy the file.
File.Copy(path, path2)
Console.WriteLine("{0} was copied to {1}.", path, path2)
Catch e As Exception
Console.WriteLine("The process failed: {0}", e.ToString())
End Try
Else
Console.WriteLine("{0} does not exist.", path)
End If
End Sub
End Module
"Paul W Smith" <pws@xxxxxx> wrote in message
news:OzUjVwymIHA.5660@xxxxxx
>I would like to have a simple application that copies a file from one
>folder to another, changing the name of the file and overwriting the file
>in the destination location.
>
> Copy: C:\abc\def\ghi\jklmnopqrt.txt (long file name)
>
> to
>
> C:\zyx\wvu\tsrq\ ..... overwriting file xxxx.text
>
> I have been able to do this using a simple DOS batch file but this does
> not work with long file names.
>
> In windows terms I would like a short-cut on my desktop to an application
> which does this procedure on demand.
>
> Using a batch file was so simple is it complicated because of the use of
> lonf file names?
>
> Any advise or code greatfully received.
>
> Paul Smith
>