Trouble with Turbo Integrator EXECUTECOMMAND(rmdir) command?

Post Reply
mcwood
Posts: 2
Joined: Wed Jun 24, 2015 11:36 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2013

Trouble with Turbo Integrator EXECUTECOMMAND(rmdir) command?

Post by mcwood »

I'm having trouble with calling an EXECUTECOMMAND to delete a directory with the windows "rmdir" command. There are other EXECUTECOMMANDs in the same TI process that work just fine, although they are calling "xcopy" and not "rmdir". Is there a documented issue with calling "rmdir" from a TI that I wasn't able to find?

For context, this process is designed to save incremental backup versions of a small demo I am developing locally.

The EXECUTECOMMAND code in TI is as follows:

Code: Select all

cmd = 'rmdir /S /Q' | ' "' | vPath | '"';
EXECUTECOMMAND ( cmd, 0 );
The output for the command I'm building is as follows:

Code: Select all

rmdir /S /Q "C:\path\target_directory_for_deletion"
This is the expected output. The path is enclosed in quotes because there are directories names with spaces in the path - this is the case with other paths I'm using as well and they work fine.

Yet, when I call this command as part of EXECUTECOMMAND(cmd, 0);, the TI aborts with error "The system cannot find the file specified". When I call the exact same command, character for character according to my textoutput, via the normal command line, it completes successfully. This error happens in TI even when the "rmdir" EXECUTECOMMAND is the only one non-commented, so I don't think this particular issue is being caused by some sort of "interference" with another command - although I'll admit I'm not a command line expert.

If you need any other information please let me know - thanks.
Alan Kirk
Site Admin
Posts: 6667
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: Trouble with Turbo Integrator EXECUTECOMMAND(rmdir) comm

Post by Alan Kirk »

mcwood wrote:I'm having trouble with calling an EXECUTECOMMAND to delete a directory with the windows "rmdir" command. There are other EXECUTECOMMANDs in the same TI process that work just fine, although they are calling "xcopy" and not "rmdir". Is there a documented issue with calling "rmdir" from a TI that I wasn't able to find?

...

Yet, when I call this command as part of EXECUTECOMMAND(cmd, 0);, the TI aborts with error "The system cannot find the file specified". When I call the exact same command, character for character according to my textoutput, via the normal command line, it completes successfully. This error happens in TI even when the "rmdir" EXECUTECOMMAND is the only one non-commented, so I don't think this particular issue is being caused by some sort of "interference" with another command - although I'll admit I'm not a command line expert.
Your problem is a pretty fundamental one; xCopy is an external command (that is, it has an .exe file that you are calling from the ExecuteCommand call), but rmdir is not; it's internal to Windows command line. The two options that you have are to wrap it in a batch file and call the batch file, or alternatively place the command

Code: Select all

cmd /c 
before the rmdir command to indicate that you're sending rmdir to the command line via the cmd.exe executable.

The name ExecuteCommand is slightly misleading; what you can really execute is not a command as such (like rmdir), but rather "something executable" such as an .exe file (like cmd.exe or xcopy.exe) or a .bat batch file.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
mcwood
Posts: 2
Joined: Wed Jun 24, 2015 11:36 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2013

Re: Trouble with Turbo Integrator EXECUTECOMMAND(rmdir) comm

Post by mcwood »

Ah, I see now. Thanks, much appreciated!
Post Reply