I would like to export the account data periodically using CLI data loader and generate the export file names dynamically with export time stamps.Eg:- If i am running the export @28-Mar-2016 , file should be "AccountExport28-Mar-2016" .Any idea how to do this
The SETTING UP DATA LOADER 9.0 FOR AUTO PROCESSES cheatsheet has an entry key that will help here:
<entry key="dataAccess.name" value="C:\Program Files\salesforce.com\Apex Data Loader 9.0\test\ extract.csv" />
Signifies the location and file name of the dataaccess type process.
If running a csvRead, the process will look for the file in this location.
If running a csvWrite, the process will replace the file in this location.
There is an example of this in the dataloader source code.
You will need to update the
dataAccess.name entry in the process-conf.xml with the required output format.
The output file name is set with the dataAccess.name property which can be set dynamically in the command line.
From https://github.com/forcedotcom/dataloader README
The command-line version runs with whatever properties you have in your config.properties file, but you can also pass paramters at runtime as arguments to the program.
For example, the following command sets the operation to insert regardless of what settings are contained in the config.properties file:
java -cp target/dataloader-xx.0-uber.jar -Dsalesforce.config.dir=CONFIG_DIR com.salesforce.dataloader.process.ProcessRunner process.operation=insert
I would recommend extending (or creating another) process.bat file to support these parameters, instead of hard-coding it in process.bat. To do so, open process.bat and find this line
"%JAVA_HOME%\bin\java" -cp ..\dataloader-42.0.0-uber.jar -Dsalesforce.config.dir=%1 com.salesforce.dataloader.process.ProcessRunner %PROCESS_OPTION%
and add %3% at the end like this
"%JAVA_HOME%\bin\java" -cp ..\dataloader-42.0.0-uber.jar -Dsalesforce.config.dir=%1 com.salesforce.dataloader.process.ProcessRunner %PROCESS_OPTION% %3%
Then when running process.bat add the parameter(s) in quotes
cd "C:\Program Files (x86)\salesforce.com\Data Loader\bin\" process.bat ../myconfigdir AccountExport "dataAccess.name=C:\OutputDir\output %mydate%_%mytime%.csv"