Page 1 of 1

Copy files from one folder to another using.bat files

Posted: Wed May 09, 2007 11:26 am
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.

Posted: Wed May 09, 2007 4:22 pm
by ray.wurlod
Try the /B switch with COPY. This implements a binary copy and does not append an end of file mark.

Posted: Wed May 09, 2007 6:56 pm
by chulett
Been there, done that, answered the question already. Curious how many incorrect places this question will get posted? :?