vlt --credentials admin:admin export -v http://localhost:4502/crx /content/dam/geometrixx-outdoors/activities /Users/temp/data
The above command works fine and exports the Assets in “geometrixx-outdoors/activities” to jcr_root and META-INF folders. If these folders are missing, the command would even create them.
But if run the same command using a different source (geometrixx/portraits) and same destination(/Users/temp/data) like:
vlt --credentials admin:admin export -v http://localhost:4502/crx /content/dam/geometrixx/portraits /Users/temp/data
The command errors with the message [ERROR] Not such remote file: /content/dam/geometrixx/portraits
But if i use a different destination folder (/Users/temp/data/new), the same command works:
vlt --credentials admin:admin export -v http://localhost:4502/crx /content/dam/geometrixx/portraits /Users/temp/data/new
Below is a shell script to use VLT Tools’ export command to the same destination folder.
Every time vlt export command executes, jcr_root and META-INF folders are created. META-INF holds the config files and jcr_root maps to the jcr’s source path. The exported files reside here.
If we use the same destination folder for all your exports, because of the path written in filter.xml, consecutive exports won’t work. To overcome this, i’m doing the following:
Make a copy of the filter.xml (i’m calling it as master filter) with /content as path. Since all content in jcr generally comes under this, so any export at any source path will work.
Since we are planning to use the same destination folder for all our exports, delete the existing filter.xml file and replace it with the above master filter.xml
Copy of the shell script and filter.xml
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/content">
<exclude pattern="/content/jcr:system"/>
<exclude pattern="/content/var/classes"/>
<exclude pattern="^.*/rep:accessControl"/>
</filter>
</workspaceFilter>
vlt-export-same-destination.sh
#!/bin/bash
# This script is used to export the contents from AEM CRX to an external folder.
# $1 - Source path from where the files need to be copied from
# $2 - Destination path where the files need to be copied to
#
# Step 1 - Make sure the vault-cli sources are in path
export PATH=$PATH:/Users/Software/vault-cli-3.1.16/bin
#
# Step 2 - vlt overwrites/creates the filter.xml with the source path. We need this to be removed as consecutive exports will not work if the path is not set to the source. To avoid this we remove the filter.xml and copy a file that has /content as the root so any export will work.
echo $'***Resetting filter.xml for the export...'
rm -f $2/META-INF/vault/filter.xml
cp -f /Users/temp/data/filter.xml $2/META-INF/vault
echo $'***Completed resetting filter.xml'
#
# Step 3
echo $'***Starting to execute vlt command...'
vlt --credentials admin:admin export -v http://localhost:4502/crx $1 $2
echo $'***Completed vlt command successfully'
Source: https://techinpieces.com/how-to-use-vlt-tools-vlt-export-command-to-same-destination-folder-on-aem/
No comments:
Post a Comment
If you have any doubts or questions, please let us know.