ExecuteCommand Copy file

Post Reply
Mark RMBC
Community Contributor
Posts: 292
Joined: Tue Sep 06, 2016 7:55 am
OLAP Product: TM1
Version: 10.1.1
Excel Version: Excel 2010

ExecuteCommand Copy file

Post by Mark RMBC »

Hi all,

Not sure if this is the appropriate forum for this because I suspect it is more a command line question than a TM1 problem, but here goes anyway

I have a .bat file to copy a csv from one location to another but the csv file name includes a hyphen character (char(150))

When I run the executecommand with the hyphen included I get an error but if I run it without the hyphen it runs ok.

I get the same issue if I run the .bat file outside TM1, i.e. by double clicking it. It just says cannot find file.

I strongly suspect that the command line can’t read the hyphen and is making it a u with circumflex.

The problem is I don’t know how to fix it other than getting the file renamed at source! Any help would be appreciated.

The .bat command is as follows:

Copy "C:\TEMP\06.08 Text Imports 08 Rep Agency*.CSV" "C:\06.08 Text Imports 08 Rep Agency Information New Reqs_A.CSV" > C:\myTestfileA.txt

cheers, Mark
User avatar
gtonkin
MVP
Posts: 1192
Joined: Thu May 06, 2010 3:03 pm
OLAP Product: TM1
Version: Latest and greatest
Excel Version: Office 365 64-bit
Location: JHB, South Africa
Contact:

Re: ExecuteCommand Copy file

Post by gtonkin »

Hi Mark, not seeing the same issue on my side - char 150 is emdash (AFAIK in office/windows and extended ascii in command line, u with circumflex), not a hyphen.
I also notice that you are copying from a list using a wildcard, to one file i.e. last file copied remains-is this what you need or are you wanting to concatenate?
Could you post a dir list of the files so that we can see if there is something else at play.
May also be worthwhile showing what ends up in C:\myTestfileA.txt and any errors written to console.
User avatar
macsir
MVP
Posts: 782
Joined: Wed May 30, 2012 6:50 am
OLAP Product: TM1
Version: PAL 2.0.9
Excel Version: Office 365
Contact:

Re: ExecuteCommand Copy file

Post by macsir »

Are you merging multiple files into one? I tried file names with both characters ( - and ^) , they are all fine.
In TM1,the answer is always yes though sometimes with a but....
http://tm1sir.blogspot.com.au/
Mark RMBC
Community Contributor
Posts: 292
Joined: Tue Sep 06, 2016 7:55 am
OLAP Product: TM1
Version: 10.1.1
Excel Version: Excel 2010

Re: ExecuteCommand Copy file

Post by Mark RMBC »

Hi,

thanks for the feedback, much appreciated.

I am not copying multiple files, only one file. However the source file name will always include the date at the end of the name. So the wildcard just picks up the file for that day and because I am using it as a datasource in a TI process I copy it as the datasource name.

The actual file name is as follows (The first dash is char 45, which works fine but the second is char 150, which appears to stop the command working. The C:\myTestfileA.txt simply says 0 file(s) copied.)

06.08 Text Imports - 08 Rep Agency Information New Reqs_05092017

This is supposed to end up with the name:

06.08 Text Imports - 08 Rep – Agency Information New Reqs

If I put the second dash, the char 150, in the destination part of the .bat copy process the name of the file created is as follows:

06.08 Text Imports - 08 û Rep Agency Information New Reqs_Load

Notice how the second dash, the char 150 is now converted to u with circumflex

macsir – your dash is char 45 not char 150?

cheers, Mark
User avatar
gtonkin
MVP
Posts: 1192
Joined: Thu May 06, 2010 3:03 pm
OLAP Product: TM1
Version: Latest and greatest
Excel Version: Office 365 64-bit
Location: JHB, South Africa
Contact:

Re: ExecuteCommand Copy file

Post by gtonkin »

Having a problem creating a file with the char(150) in the name-tried Excel VBA, File explorer etc. and it keeps replacing with a normal dash.
Could you upload a sample file, without the data of course.
Mark RMBC
Community Contributor
Posts: 292
Joined: Tue Sep 06, 2016 7:55 am
OLAP Product: TM1
Version: 10.1.1
Excel Version: Excel 2010

Re: ExecuteCommand Copy file

Post by Mark RMBC »

Please see attached file:
tomok
MVP
Posts: 2831
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: ExecuteCommand Copy file

Post by tomok »

I'm just going to cut to the chase. Any person and/or system that would use the embash character (chr150), or for that matter any character that doesn't appear on the keyboard, in a file name is an idiot. You need to go to this person, slap them silly, and make them change their system to give you a decent file name and be done with it.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
Mark RMBC
Community Contributor
Posts: 292
Joined: Tue Sep 06, 2016 7:55 am
OLAP Product: TM1
Version: 10.1.1
Excel Version: Excel 2010

Re: ExecuteCommand Copy file

Post by Mark RMBC »

Yes Tom I arrived at that conclusion also!

I have actually asked for the file name to be changed, but out of curiosity was wondering if anyone had a solution!
User avatar
gtonkin
MVP
Posts: 1192
Joined: Thu May 06, 2010 3:03 pm
OLAP Product: TM1
Version: Latest and greatest
Excel Version: Office 365 64-bit
Location: JHB, South Africa
Contact:

Re: ExecuteCommand Copy file

Post by gtonkin »

As soon as I save the file, seems to lose the char(150) and substitutes with a regular hyphen-cannot really do much more. Hopefully they will rename and you can move forward. I have had similar filenames in the past for Unix environments but managed to work with them by simply surrounding names in double quotes, as you had. Good luck.
User avatar
macsir
MVP
Posts: 782
Joined: Wed May 30, 2012 6:50 am
OLAP Product: TM1
Version: PAL 2.0.9
Excel Version: Office 365
Contact:

Re: ExecuteCommand Copy file

Post by macsir »

of course, mine is printable keyboard dash, just let you know. :lol:
In TM1,the answer is always yes though sometimes with a but....
http://tm1sir.blogspot.com.au/
Mark RMBC
Community Contributor
Posts: 292
Joined: Tue Sep 06, 2016 7:55 am
OLAP Product: TM1
Version: 10.1.1
Excel Version: Excel 2010

Re: ExecuteCommand Copy file

Post by Mark RMBC »

Appreciate all your efforts.

I have managed to get the file name changed! The other option would have been to put an asterix before the char 150 dash but fortunately don’t have to do this!
Post Reply