When uploading files to Amazon S3 using
Upload Artifacts to S3 step, the default behavior is to retain the parent folder names in the file paths. However, there may be situations where you want to remove the parent folder name from the file path during the upload process.
To trim down the parent folder name while uploading files to S3, follow these steps:
Add Stage Variable:
In your deployment template or configuration, add a stage variable with the name
PLUGIN_STRIP_PREFIX. This variable will be used to specify the parent folder name that needs to be removed from the file paths.
Set the Value of
Assign the value of
PLUGIN_STRIP_PREFIXto be the name of the parent folder that you want to eliminate from the file paths. This value will be used to manipulate the file paths during the upload process.
Assume you have the following file structure:
If you want to remove the
Parent_Folder name from the file paths during upload, set the