This solution by @DanM worked for when deleting one file:
Thank you, Dan!
Now I have a workflow that points to a directory and then uses a batch macro to run through all the files contained in the directory. When completed, I want to delete all of the files in the directory. I think I can use a similar method but I can't get it to work.
Solved! Go to Solution.
I got this a little closer. It's now deleting all files except one.
I've tried different combinations and after each run it leaves out one file.
I think I'm close here. What am I missing?
I got a little further. It's up on the gallery and working but I see this error:
It's still leaving one file behind when the bat file is executed.
Sorry for so many posts! This is a developing situation!
If anyone stumbles on this post, I still haven't resolved this. One file remains in the directory after the .bat file is executed.
@MarqueeCrew came to my rescue here with the solution! Without even seeing my workflow, he was able to pin point my mistake.
It turns out that I had moved the bat file to another location so I needed to change the command to delete the bat file at that location. The mistake was clear when we viewed the text contained in the bat file. After inserting a carriage return before each "DEL ", I could see that the "DEL " was clearly missing from the last file.
@MarqueeCrew Thank you for taking the time to stop and help a newbie user. I sincerely appreciate it. I hope I know as much as you do about Alteryx 12 years from now!
Hi,
Attaching a macro to delete all files from a directory.
Don't forget to edit Options > User Settings > Macros and enter the path so that the saved macro will be available in the workflow.
Reference:
https://www.theinformationlab.co.uk/2017/08/10/delete-files-alteryx-cleaning-computer-part-1/
Thanks