Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How to delete all files in a directory after a batch macro is complete

ddiesel
13 - Pulsar
13 - Pulsar

This solution by @DanM worked for when deleting one file:

https://community.alteryx.com/t5/Alteryx-Knowledge-Base/Batch-Files-in-Alteryx-Part-3-Deleting-Files...

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. 

6 REPLIES 6
ddiesel
13 - Pulsar
13 - Pulsar

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?

 

 

Capture.PNG

 

 

Capture.PNG

 

 

Capture.PNG

ddiesel
13 - Pulsar
13 - Pulsar

I got a little further. It's up on the gallery and working but I see this error:

 

Capture.PNG

 

It's still leaving one file behind when the bat file is executed.

 

Sorry for so many posts! This is a developing situation!

ddiesel
13 - Pulsar
13 - Pulsar

If anyone stumbles on this post, I still haven't resolved this. One file remains in the directory after the .bat file is executed.

ddiesel
13 - Pulsar
13 - Pulsar

@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!

raghusrealm
8 - Asteroid

@ddiesel Can you please share this workflow to delete files from a folder.

 

thanks

Raghu

bist
5 - Atom

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

Labels