Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Moving files to another directory

oce
5 - Atom

Hi all! I need a workflow to periodically check if there are new excel files in a directory, and if there are, they need to be moved to another directory. The workflow I have built (see attachment) works fine if there are any excel files available and moves them to the desired folder, however, it throws the following error if the directory is empty:

 

 

Error: Run Command (17): The external program "%temp%\MoveFiles.bat" returned an error code: 1

 

oce_1-1632320098581.png

 

 

Is there a way to stop/finish this workflow without throwing an error if there are no excel files to be moved? Any help will be greatly appreciated.

17 REPLIES 17
Zas3nfkb
8 - Asteroid

Hi,

 

Unfortunately I dont think there is a way to suppress errors (though please someone correct me) but based on this workflow, do you think this could be better accomplished using windows scheduler to run the bat file? I would think its a more seamless execution. 

messi007
15 - Aurora
15 - Aurora

@oce,

 

Please make sure that the target file exist and you have at least one excel file in the source folder.

I updated cmd tool and works fine.

 

messi007_0-1632324149481.png

 

messi007_0-1632324344995.png

 

 

Attached the workflow,

Hope this helps!

Regards,

atcodedog05
22 - Nova
22 - Nova

Hi @oce 

 

You can use blob tools.

 

When file is present:

atcodedog05_0-1632324971525.png

 

When no files are there:

atcodedog05_1-1632325007532.png

 

Hope this helps : )

oce
5 - Atom

Hi @atcodedog05, 

 

Thanks a lot, this is definitely working also when no files are present in the directory. The only thing is that the files are not moved from the initial directory but copied, so they still exist there too. Do you know if & how I can modify the blob tools to behave like "cut & paste" instead of "copy & paste"? 

 

 

atcodedog05
22 - Nova
22 - Nova

Hi @oce 

 

Sorry nope 😶 it works only has copy and paste.

 

What you can do is use a filter and filter the files that was created today. That way only newly created files are moved.

 

Workflow:

atcodedog05_0-1632382489795.png

 

Hope this helps : )

oce
5 - Atom

@atcodedog05 This solves my problem, thanks a lot! 🙂

atcodedog05
22 - Nova
22 - Nova

Happy to help : ) @oce 

Cheers and have a nice day!

jsilavong
8 - Asteroid

Could someone please share the .bat file that was used for command run tool

Luke_C
17 - Castor

@jsilavong Look at @messi007 's solution. The bat file is created on the fly by the workflow. The formula tool dynamically generates. 

Labels