473,407 Members | 2,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Re: Simple Batch Type Program

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" <pw*@NOSPAM.twelve.me.ukwrote in message
news:Oz**************@TK2MSFTNGP02.phx.gbl...
>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
Jun 27 '08 #1
0 969

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Paul Reddin | last post by:
Hi, (V8.1 Fp2) Our application uses JDBC batch to execute mutiple insert statements and we saw a strange thing this morning. There were 4 SQL Insert statements in the batch, and we know the...
3
by: | last post by:
I am trying to compile a simple c# class in Web Matrix called howdy.cs: // Program start class public class HowdyPartner { // Main begins program execution public static void Main() { //...
2
by: Blippy | last post by:
I want to create a small look up program that searches for a certain date and the batch number that is represented by that day. For instance if i wanted to find the batch for 20/08/05 i would...
3
by: emman_54 | last post by:
Hi every one, I am trying to run a batch file using my asp.net application. I am using the Process class to run the batch file. When I run my web application, In the task manager, i could see...
4
by: | last post by:
Hello, I am attempting to convert multiple .wav files to the .flac format via a batch script. I know that this can be done with numerous software implementations automatically for me; however, i am...
28
by: Tim Daneliuk | last post by:
I have a program wherein I want one behavior when a file is set as executable and a different behavior if it is not. Is there a simple way to determine whether a given named file is executable...
10
true911m
by: true911m | last post by:
This is a simple walkthrough to get PyInstaller up and running. I decided to give PI a try, because it claims to be more selective about what it bundles into its executable files by default, and...
9
by: sesling | last post by:
We have several batch programs that users need to run each day to move data around our system. The batch files require the user to enter criteria when launching the program. To help simplify this I...
0
by: Raakish | last post by:
Hello I am trying to use a batch file to run a DTS program that I had created. Below is the Batch File code: REM Type: Batch File REM Created by: Raakish REM Contact: raakish22@gmail.com REM...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.