This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
I would like to use Events to run a (self-deleting) batch file after every run that deletes certain files (*.bak files as well as a *.xlsm).
The batch file looks as follows:
if exist "..\Output\Test GmbH - Steuerbescheinigungen\" DEL "..\Output\Test GmbH - Steuerbescheinigungen\*.bak" "..\Output\Test GmbH - Steuerbescheinigungen\Test GmbH - 2018-11-19 13_02 - Hilfsdatei Steuerbescheinigungen.xlsm"
(GOTO) 2>nul & del "%~f0"
After running my workflow, Alteryx returns that the event has run successfully.
Designer x64 The Designer x64 reported: Completed Event #1: After Run: Run 50a EStG - Workflow - Löschen Steuerbescheinigungen Hilfsdateien.bat
However, although the BAT file deleted it self, none of the BAK files were deleted. But when I create the BAT file without the self deleting part and manually execute it after the Alteryx Workflow was finished, the BAK files (and the other file) are deleted correctly - hence, I'm rather confident that the error is not in my BAT file but rather in some kind of misunderstanding I have about how events work.
Thank you for the quick response. The error message did not return anything useful but your answer got me thinking and I figured out where my understanding of the events were wrong:
I save the BAT files in a subdirectory and build the relative file paths accordingly. Manually executing the BAT files yielded the expected results. However, using "Events" the BAT file was run in the same directory as the workflow and, thus, I needed to adjust my relative pathing to the directory of my workflow instead of the location the BAT files are saved. I don't know if I could have achieved the same result but using the "Working directory" in the event options.