Does any one know if it is possible to use the “Delete File” in an automation script to delete multiple files in a folder?
I have create an automation script that generates numbered PDF file for order confirmation notes for that days orders
Ie Order1.pdf, Order2.pfd
The PDF’s are placed into a folder, the folder is then zipped and emailed.
This works fine but I have a problem when the script runs on the next day and generates a new set of PDF files then the files from the previous day are still in the folder which get zipped.
Is there are way to delete multiple files using a wildcard character?
I can use the “Delete File” to delete a single named file but not multiples.
Unfortunately, there is no direct way to submit wildcard character in the file name for the delete file activity. But if you’re working with TDA 3.0, there is a workaround. To use * in the delete file activity in TDA 3.0, you should use the “old” way of submitting activity properties:
Double-click delete file activity in the designer. On the right-hand side you’ll see a property grid.
Select Files property in the Misc section of it and click the button to the right from (Collection) text.
In the FileDescription Collection Editor click Add button, new FileName description will be added to the FileDescription properties pane.
Select FileName property in that pane and open a dropdown - standard Open File dialog will be displayed.
Select ANY file in the directory containing your pdf files you’ll want to delete and close the dialog. Now you can manually edit FileName property, replacing filename part with something like *.pdf. Close FileDescription Collection Editor. You’re all set.
Of course, you can omit steps 4 and 5 and manually add full file name here instead (e.g., c:\temp*.pdf).
We’re working on bringing wildcard characters support in delete files activity.
Just wondering if this is possible using Toad Data Point - i’m hoping to be able to delete everything in a specified folder. Alternatively, i want to delete the latest file in that specified folder.
I have tried the steps above but can’t get it to work.
I’ve solved this in the past by simply creating a batch file and using the Run Program feature to call it - an extra step admittedly but does the trick