It is found that Purge activity does not delete the files in Windows environment because '/' is used as path separator in PURGE_XXX.bat file.Can the path separator be configured? Or any other configurations?

It is found that Purge activity does not delete the files in Windows environment because '/' is used as path separator in PURGE_XXX.bat file.Can the path separator be configured? Or any other configurations?

book

Article ID: KB0085796

calendar_today

Updated On:

Products Versions
TIBCO Collaborative Information Manager -
Not Applicable -

Description

Resolution:
It is found that Purge activity does not delete the files in Windows environment because '/' is used as path separator in PURGE_XXX.bat file.  Can the path separator be configured? Or any other configurations?

Environment:

TIBCO Product name and version: TIBCO Collaborative Information Manager 7.2.1
Operating System(s): Microsoft Windows Operating Systems

Symptoms:

None

Cause:

None

Resolution:

The solution to this is to replace the PurgeFilesThroughShellScript activity in the purge workflow as follows and see if the files are getting deleted.

    &ltActivity Name="PurgeFilesThroughShellScript">
        &ltAction&gtInterpretCommand</Action>
        &ltDescription lang="en"&gtDelete the files associated with purged data</Description>
        &ltParameter direction="in" eval="variable" type="string" name="purgefilepath"&gtrelativepath</Parameter>
        <!--Parameter direction="in" eval="constant" type="string" name="shellscriptname"&gtdeletepurgefiles.sh</Parameter-->
        &ltScript format="bsh"><![CDATA[
                
                
        java.lang.String commonDir = "";
        java.lang.String relativepath ="";
        
        try {
            commonDir = com.martquest.util.EnvUtil.getDirEnvironmentVariable(com.martquest.util.IMqEnvVars.MQ_COMMON_DIR);
            java.io.File file=new java.io.File(commonDir, purgefilepath);
            java.io.RandomAccessFile raf = new java.io.RandomAccessFile (file,"rw");
            com.martquest.util.MqLog.log("InterpretCommand", com.martquest.util.MqLog.INFO, "Purge : Reading the file ... : " + file.getAbsolutePath());
            java.lang.String line = null;
            while ((line = raf.readLine()) != null)
            {
                java.io.File fileTmp=new java.io.File(commonDir, line);
                if(fileTmp.exists())
                {
                    boolean res = fileTmp.delete();
                    if (!res)
                    {
                        com.martquest.util.MqLog.log("InterpretCommand", com.martquest.util.MqLog.WARNING, "Purge : Could not delete file : " + fileTmp.getAbsolutePath());
                    }
                    else
                    {
                        com.martquest.util.MqLog.log("InterpretCommand", com.martquest.util.MqLog.INFO, "Purge : Deleted file : " + fileTmp.getAbsolutePath());
                    }
                }
                else
                {
                    com.martquest.util.MqLog.log("InterpretCommand", com.martquest.util.MqLog.WARNING, "Purge : File not found : " + fileTmp.getAbsolutePath());
                }
                
            }
        } catch (java.io.IOException e) {
            com.martquest.util.MqException me = new com.martquest.util.MqException(com.martquest.util.MqErrorCodes.IOERROR, e);
            me.setArg(com.martquest.util.MqErrorCodes.FILENAME, relativepath );
            throw me;
            
        }  
            
     ]]></Script>
    </Activity>

Attachments:

None

References:

None

Issue/Introduction

It is found that Purge activity does not delete the files in Windows environment because '/' is used as path separator in PURGE_XXX.bat file.Can the path separator be configured? Or any other configurations?