Copy files from one folder to another using.bat files

This forum is in support of all issues about Data Quality regarding DataStage and other strategies.

Moderators: chulett, rschirm

Post Reply
abilashkreddy
Participant
Posts: 20
Joined: Thu Nov 16, 2006 1:32 pm
Location: louisville

Copy files from one folder to another using.bat files

Post by abilashkreddy »

The Copy function in Batch files which are used to copy files(.csv) from one drive to another drive which are used as inputs in Datastage

The name of the file is ActionCode_2007-5-7_16213.csv

IF EXIST %FileFromDrive%\ActionCode*.csv COPY %FileFromDrive%\ActionCode*.csv %FileToDrive%\ActionCode.csv /Y

When I am using this command in batch file to copy files from one drive to another, it copies the file and renames it, but when you look at the records in the file. A new record is added with a symbol "" in thelast row and the first column of the target file. ( is an arrow symbol).

Everytime the file comes in weekly, the date and the number changes.I have tried several ways in naming the file name. like the one above. then with date and *after the date , then with * and number at the end of the file name, but I was having the same error.

When you try copying using the whole file name, it is copying perfectly.

Can anyone help in resolving this issue about how to copy the file wihout the arrow symbol.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Try the /B switch with COPY. This implements a binary copy and does not append an end of file mark.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Been there, done that, answered the question already. Curious how many incorrect places this question will get posted? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply