Managing server space efficiently through regular directory cleanup is essential in Adobe Campaign, particularly when dealing with export or upload folders that tend to accumulate outdated or redundant files over time. These leftover files—often created during development, testing, or repeated exports—can quickly consume valuable server resources and even pose risks if they contain sensitive data.
While Adobe Campaign natively provides only limited tools for direct directory management on the server, this limitation doesn’t mean you’re stuck relying on Adobe Support or Tech Ops for maintenance. Instead, with the right custom JavaScript approach, you can take ownership of this task, automate the cleanup process, and maintain a healthy, optimized campaign environment—boosting both system performance and operational efficiency.

Common Scenarios Necessitating Directory Cleanup:
- Temporary storage of export files before transferring to SFTP or as email attachments.
- Accumulation of multiple file versions during development or testing phases.
- Retention of orphaned files containing Personally Identifiable Information (PII).
- Desire to independently manage file cleanup without relying on Adobe Support or Technical Operations.
Implementing the Cleanup Script:
The following JavaScript snippet can be utilized within a workflow’s JavaScript activity to automate the deletion of files matching specific patterns:
//Update FOLDER_PATH per your client's AC box var FOLDER_PATH = "/usr/local/neolane/nl6/var/<CLIENT_NAME>/export/" //Update FILE_NAME_PATTERN with wild card /* "*.*" : all files "*.txt" : all text files *.csv" : all csv files "A*.*" : all files whose name starts with 'A' "A*Z.csv" : all csv files whose name starts with 'A' and ends with 'Z' */ var FILE_NAME_PATTERN = "*.csv" var objDirectory = new File(FOLDER_PATH) var objFiles = objDirectory.list(FILE_NAME_PATTERN) logInfo("Count of files that match search criteria are : " + objFiles.length) for each(var objFile in objFiles) { //For other properties of objFile (the File object), refer AC's jsapi.chm documentation logInfo("Deleting file: " + objFile.name + " - last modified at " + objFile.lastModified); objFile.remove(); }
Deployment Steps:
Navigate to the desired workflow in Adobe Campaign.
Add a new JavaScript activity.
Paste the above script into the activity.
Adjust
FOLDER_PATH
andFILE_NAME_PATTERN
as per your requirements.Schedule the workflow to run at desired intervals for periodic cleanup.
Best Practices:
Ensure that the script is tested in a development environment before deploying to production.
Maintain proper logging to monitor the cleanup activities.
Implement access controls to restrict unauthorized modifications to the script.
Conclusion:
By integrating this automated cleanup script into your Adobe Campaign workflows, you can maintain an organized file system, enhance performance, and uphold data compliance standards. Regular directory maintenance is a proactive step towards efficient campaign management.