community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Moving Processed Input Files within a Workflow

Asteroid

Hello!

 

This is my first question to the community.  Hoping someone can help.

 

On a daily basis we receive a “new data” xlsx file (always with a different filename) which is saved into a folder called “Raw”.

 

Once a week or so, we run an Alteryx process which:

  • Inputs all the xlsx files in the “Raw” folder, (so usually about 7 files)
  • Processes them
  • Then finally appends the new data to Sheet1 in a file called “Master.xlsx”

 

The “new data” xlsx files need to be moved from “Raw” to a folder called “Processed” immediately AFTER they’ve been added to Master.xlsx but BEFORE the workflow ends to ensure all the new data files are processed and added to the master once and only once. 

 

I don’t mind if this happens to each file in turn ie

  • new data file 1: ADD to master THEN MOVE;
  • new data file 2: ADD to master THEN MOVE;
  • new data file 3: ADD to master THEN MOVE etc

OR if the add/move happen in a lump ie

  • ALL new data files: ADD to master
  • THEN ALL new data files: MOVE

 

Does anyone know how (if!) I can achieve this please?  I’m a complete Alteryx novice, so although I’ve seen similar questions asked eg…

https://community.alteryx.com/t5/Data-Preparation-Blending/Copying-multiple-text-files-from-one-fold... 

https://community.alteryx.com/t5/Setup-Configuration/Configure-Run-Command-tool-to-move-a-file/m-p/1...

https://community.alteryx.com/t5/Alteryx-Knowledge-Base/Batch-Files-in-Alteryx-Part-2-Moving-Files/t...

…I am confused by which technique best suits my needs and how to tweak it.   

 

The data are confidential, but I’ve attached illustrative "Master" and "new data" xlsx files. 

 

Again, thanks so much for your kind help.

 

Alteryx Certified Partner

The easiest way to accomplish what you describe below is with a workflow event. Set up the workflow event to execute after run without errors: 

 

events.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

The above command grabs every file in the RAW directory and moves them to the processed directory. If you do not want to grab all files you can limit the wildcard. In your case something like c:\files_location\raw\new_file*... finally if you do not want to issue the command via a workflow event you can use the run command tool.

 

Its always good to keep your work as simple as possible, but if needed you can also archive files as they are processed using batch macros. This method is more complex, but it allows you to dynamically build the move file command and error handling for each individual file. 

Asteroid

Thanks so much for the help Kanderson! 

 

This seems like the perfect, elegant solution. 

 

I've used your command line (image pasted below) correctly I believe, but there's an error (also pasted below) saying "...The system cannot find the file specified." so I must be missing something but I can't see where I'm going wrong.

 

Hope you can help.  Thanks in advance.

 

alteryx event2.pngalteryx event1.png

Alteryx Certified Partner

Add your command to a .bat file, then reference the file in the workflow event:

 

I made a folder on my desktop and tested by moving some .csv files. I used the below command:

 

move C:\Users\KAnderson\Desktop\RAW\*.csv C:\Users\KAnderson\Desktop\RAW\processed\

 

Open a text editor, paste in your command and save as a .bat file. You can test that it works by double clicking it and seeing that the files move. Once that is done replace the command with your file using the browse button:

bat file example.JPG

Alteryx Partner

In the Event where the command was set to "move c:\tp_temp\raw\* c:\tp_temp\processed" you would need to change things around a little.

 

The Command value should be "cmd.exe"

The Command Arguments value should be "move c:\tp_temp\raw\* c:\tp_temp\processed"

 

If you precede the command argument with a /c, the cmd.exe program will carry out the command and then terminate. You can get all the command line switches by typing cmd /? inside the cmd.exe window.

 

The suggestion to create a batch file is also a good one. Having a batch file is 'evidence' that a process was run.

Asteroid

Woohoo!  THANK YOU!!!!

Asteroid

Tom - I tried your way too and it also worked like a dream. 

 

Thanks so much to both of you for sharing your expertise.  I wouldn't have been able to do this without you.

 

 

Meteor

Hi There,

 

I tried all three of these solutions and they don't work for me.  I'm trying to move a folder within our SharePoint.  I used this full path trying both forward slashes and back slashes in the .bat file and also within the Command Argument line with cmd.exe in the Command Value line.  

//apps.sp.kp.org/services/hcrhix/HPS Reports Library/Impact Lists/To Be Run/*.xlsx  //apps.sp.kp.org/services/hcrhix/HPS Reports Library/Impact Lists/Archive/

 

I also tried using this format with the mapped drive.

move H:\HPS Reports Library\Impact Lists\To Be Run\*.xlsx  H:\HPS Reports Library\Impact Lists\Archive\

 

I also tried dbl clicking the .bat file. 

 

AND I also tried move with errors, without errors, and after move.  I get this error in all scenarios:

 

Error: Designer x64: The Designer x64 reported: Error running Event #1: The external program "C:\Users\I211381\MoveSharePoint_ImpactList.bat" returned an error code: 1: The specified image file did not contain a resource section.
(1812)

 

In this link below this person mentions to abide by these recommendations:

 

-avoid spaces in Directory (folder names)

-target directories at your own computer (not working well with dropbox or mapped drives)

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Guide-to-Creating-Your-Own-Connector-H...

 

What am I doing wrong?  Can anyone help?

 

 

 

Highlighted
Asteroid

It seems that bat files just don't work on shared drive level...

Labels