Q: Is there a way to delete all contents of a destination folder before files are moved/not just overwriting them? I am unzipping a large folder with files daily, most files are named the same thing so they can overwrite them. Have a few that are named with dates and times so they just end up staying in the folder.
A: If the unzip folder is always the same, the following solution could help you. We added a script that will delete all files and subfolders when ‘On Rule Begin’ is triggered. The path you need to use in the script is the one you will use in your UNZIP as Destination setup.
– Open Pascal Script Setup
- Enable and Add the following ‘On Rule Begin’ Pascal Script. In this example our Unzip path = C:\Test\Out\UNZIP\
Don’t forget to adjust the ctOutputPath const, must end with a \
Const ctOutputPath = 'C:\Test\Out\UNZIP\'; Begin psExitCode:= 1; // ... add your code here psLogWrite(1, '', 'Delete Tree: ' + ctOutputPath); psDeleteFiles(ctOutputPath, '*.*'); psDeleteTree(ctOutputPath, True); End.
#filetransfer #mft #filemanagement