COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Cognos Administration => Topic started by: krishna.mondrathi on 08 Nov 2016 11:51:29 AM

Title: Script for clearing temp files
Post by: krishna.mondrathi on 08 Nov 2016 11:51:29 AM
Hi All,

Could you please send me the script to clear cognos Temps files using scripts in windows.

Regards
Krishna M
Title: Re: Script for clearing temp files
Post by: Dhruv on 10 Nov 2016 02:37:41 AM
Use below script:

===
net start SERVICENAME

RD /S /Q <drive>:Cognos_location\temp
mkdir <drive>:cognos_location\temp
timeout /T 2

net start SERVICENAME
===

Script will stop service, Remove contents from temp folder and Start service again.
Let me know if this works for you.
Title: Re: Script for clearing temp files
Post by: krishnadwbi on 14 Nov 2016 02:26:49 PM
Hi Dhurv,

Thanks for your mail!

Actually the below script will remove directory and recreates the same. But my requirements is delete the logs till day-1.

Could you please provide me the above script.

Regards
Krishna m
Title: Re: Script for clearing temp files
Post by: Dhruv on 16 Nov 2016 07:47:15 AM
Hello Krishna,

Below command will work for you.

forfiles -p "DESTINATION_FOLDER" -s -m *.* -d -1 -c "cmd /c echo @file"

use this command in batch file and it will remove all logs older than day -1.
Let me know if this works for you.