on 03-15-2016 04:59 PM - edited on 07-27-2021 11:43 PM by APIUserOpsDM
This is the third article in the series of renaming, moving, and deleting files using a batch file. This workflow will create a .bat file which you can use in other workflows that use the files you specify in this workflow to delete files.
WARNING: Please be careful using this command as it will do what it says it will do. Test thoroughly before adding to production.
Deleting Files
Creating the Batch file workflows:
Tools needed: (1)Directory Input, (2)Select, (3)Formula, (4)Summarize, (5)Output Tools.
Directory Tool (1) –
Select Tool (2) –
Formula Tool (3) – Output Fields Created: Command and Batch File.
'DEL '+ '"'+[FullPath]+ '"'+ ' ' + + '"'+[FileName]+ '"'
[Directory]+’Delete_files.bat'
Summarize Tool –
Output Tool (5) –
Adding Batch File to Your Workflow:
The last step is to add this batch file to the Events tab in a Workflow that you want to move the file or files you have chosen in the .bat file in the Configuration window.
See attached Sample Workflow.
Great post DanM!
Just to add - you can also set the Run Command Tool to output the batch script to a "temp" directory so that it can stay within the Alteryx workflow and can be "lifted and shifted" as required.
Hi DanM,
I'm new to the community and would like to download your workflow on this, but cannot open the attachment?
Thanks for the walkthrough! Worked for me first try.🎸 Rock N Roll!
If anyone is interested, i built a macro with the python component to do this same task. It is an alternative :)
Could you please provide a script to delete files from SFTP folder as well? I tried above to delete files from SFTP but it did not work.