Remove Unnecessary Files from an Environment

Use these scripts to remove unnecessary files from an environment.

These scripts perform the following steps:

  • Signs in to the environment.
  • Lists the files and snapshots in the environment.
  • Deletes the files specified in input.properties.
  • Signs out.

Windows Sample Script

Create a file named removeUnnecessaryFiles.ps1 by copying the following script. Store it in a local directory.

$inputproperties = ConvertFrom-StringData(Get-Content ./input.properties -raw)
$username="$($inputproperties.username)"
$passwordfile="$($inputproperties.passwordfile)"
$serviceURL="$($inputproperties.serviceURL)"
$file1="$($inputproperties.file1)"
$file2="$($inputproperties.file2)"

epmautomate login ${username} ${passwordfile} ${serviceURL}
epmautomate listfiles
epmautomate deletefile ${file1}
epmautomate deletefile ${file2}
epmautomate logout

Linux/UNIX Sample Script

Create a file named removeUnnecessaryFiles.sh by copying the following script. Store it in a local directory.

#!/bin/bash
. ./input.properties
export JAVA_HOME=${javahome}
${epmautomatescript} login "${username}" "${passwordfile}" "${serviceURL}"
${epmautomatescript} listfiles
${epmautomatescript} deletefile "${file1}"
${epmautomatescript} deletefile "${file2}"
${epmautomatescript} logout

Creating the input.properties File

To run the removeUnnecessaryFiles scripts, create the input.properties file and update it with information for your environment. Save the file in the directory where removeUnnecessaryFiles.ps1 or removeUnnecessaryFiles.sh is stored.

Windows

username=exampleAdmin
passwordfile=examplePassword.epw
serviceURL=exampleURL
file1=FILE_NAME
file2=FILE_NAME

Linux/UNIX

javahome=JAVA_HOME
epmautomatescript=EPM_AUTOMATE_LOCATION
username=exampleAdmin
passwordfile=examplePassword.epw
serviceURL=exampleURL
file1=FILE_NAME
file2=FILE_NAME

Table 3-7 input.properties Parameters

Parameter Description
javahome JAVA_HOME location. For Linux/UNIX only.
epmautomatescript Absolute path of EPM Automate executable (epmautomate.sh). For Linux/UNIX only.
username User name of a Service Administrator, who also has the Identity Domain Administrator role.
password Password of the Service Administrator or the name and location of the encrypted password file.
serviceURL URL of the environment from which you want to generate the snapshot.
file1 and file2 Name of a file or snapshot to delete from the environment. If the file is not in the Outbox, specify the path and name of the file.
   

Running the Script

  1. Create removeUnnecessaryFiles.ps1 or removeUnnecessaryFiles.sh by copying the script from a preceding section.
  2. Create the input.properties file and save it in the directory where the removeUnnecessaryFiles script is located. Contents of this file differs depending on your operating system. See Creating the input.properties File.

    Make sure that you have write privileges in this directory. For Windows, you may need to start PowerShell using the Run as Administrator option to be able to run the script.

  3. Launch the script.
    • Windows PowerShell: run removeUnnecessaryFiles.ps1.
    • Linux/UNIX: run ./removeUnnecessaryFiles.sh.