Find and Download Files from an Environment
Use the sample script in this section to automate the process of downloading one or more files from an Oracle Enterprise Performance Management Cloud environment using a text string as a wildcard.
The following script allows you to match the string that you specify as the value of the FILENAME
parameter with file names displayed using the listfiles
command and then automatically download the files that match the string.
Be sure to assign the appropriate search string to the FILENAME
parameter. For example, FILENAME="Scheduler Output/epm"
will match the string Scheduler Output/epm
against file names in the listfiles
command output in your environment to identify the files to download.
Input parameters for running this script are username
, password
or password_file
, and service_url
.
Note:
If the password contains special characters, see Handling Special Characters.Windows
@echo off
setlocal EnableExtensions EnableDelayedExpansion
set USERNAME="username"
set PASSWORD="password"
set URL="url"
call epmautomate login %USERNAME% %PASSWORD% %URL%
set FILENAME="Scheduler Output/epm"
for /f "tokens=*" %%i in ('epmautomate listfiles ^| findstr /b /r /c:"^ *%FILENAME%" ') do (
call epmautomate downloadfile "%%i"
)
call epmautomate logout
endlocal
Linux/UNIX
#!/bin/sh
USERNAME="username"
PASSWORD="password"
URL="url"
./epmautomate.sh login $USERNAME $PASSWORD $URL
FILENAME='Scheduler Output/epm'
#echo $FILENAME
./epmautomate.sh listfiles | grep "^ $FILENAME" | while read -r line ; do
echo "Processing $line"
./epmautomate.sh downloadfile "$line"
done
./epmautomate.sh logout