Alteryx Designer Desktop Discussions

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

BAT file added in events to move a file gives error and fails workflow when file not found

shobhit_gupta
7 - Meteor

Hi all,

I have a simple move command in saved as a .BAT file which moves all files in a directory to another location after my Alteryx workflow has run successfully. I have configured this in the events to run. Now, when there are files in the source folder, the script executes perfectly and moves all the files to the target location, and workflow executes successfully. Now when I run the workflow again, the move command can't find any files in the folder and obviously fails stating "The file/directory cannot be found". Subsequently, my alteryx workflow does what it is intended to but it still gives an error message at the end. I want it to bypass this error which means the workflow should not give any error even if file is not found inside the folders. I need this because I have another workflow whose run depends on the success of this workflow. Due to the error message, the second workflow does not execute (I am using a conditional  runner macro to achieve this). Any help would be appreciated. Thanks!

1 REPLY 1
flying008
14 - Magnetar

Hi,@shobhit_gupta 

 

Maybe you need add some bat code to determine if the source folder contains at least 1 file.

 

REM <check any file in source folder.>
dir /b "%source%" >nul 2>&1
if %errorlevel%==0 (
    REM < move all files to  destination folder >
    move /y "%source%\*" "%destination%\"
) else (
    REM < if null, exist. >
    exit
)
exit
Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels