Delete log files using batch script

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

Delete log files using batch script

Post by Mark RMBC »

Hi all,

When deleting log files in TM1 I tend to either use wildcardfilesearch or a batch script, but with the batch script I set up a .bat file manually and simply reference it in the TI process.

I noticed that the bedrock method seems to create the .bat file on the fly and then delete it. I therefore thought I would try this approach but I have encountered a problem. It doesn’t delete the log files!

When I look in the .bat file I see the following:

"forfiles -p "E:\FTPS ROOT" -s -m tm1s*.log -d -3 -c "cmd /c del @path" "

The start and end quotes are the problem because when I remove them the .bat file works.

My TI code is as follows (please note that I am not yet using executecommand in the ti. The ti simply creates the .bat file at this stage):

Code: Select all

vLogDays = NumbertoString(-3);
vLogDir = '"E:\FTPS ROOT"';
vPath = cellgets('adm_Assumptions', 'General', '06_Export_Folder') | '\';
vServer = cellgets('adm_Assumptions', 'General', 'Server_Name');
sFileName = vPath | 'Delete Log Files' | vServer | '.bat';
ASCIIOUTPUT( sFileName, 'forfiles -p ' | vLogDir | ' -s -m tm1s*.log -d ' | vLogDays | ' -c "cmd /c del @path" ');
User avatar
orlando
Community Contributor
Posts: 167
Joined: Fri Aug 04, 2017 8:27 am
OLAP Product: TM1
Version: PAL 2.0.8
Excel Version: Office 365

Re: Delete log files using batch script

Post by orlando »

Hi Marc,

DataSourceASCIIQuoteCharacter=''; is your friend.

When set like this, the quotes will not be set.

Best regards,

orlando
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: Delete log files using batch script

Post by Mark RMBC »

Yes that worked.

Thanks Orlando, much appreciated!
Post Reply