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

Move jpeg files to different folder depending on file names

Highlighted
Atom

Dear all, I need to move certain images from a folder (depending on if the image name have certain characters such as '( )' ), to a different folder.

Tried to use the Run Command macro but it only allows for outputs in plain text or csv... Any ideas?

 

Many thanks in advance!

 

Standard trick is to make a bat file and run that.

 

2017-11-08_15-16-06.jpg

 

Use a formula tool to change file names to Move commands

Select tool to pick just the command field

Write out as a CSV with no headers or separator to the %temp% folder

Run the batch file

 

Sample attached (moves *.bak to C:\Temp)

Atom

Thanks a lot for your answer!

I notice .bak files are being used as an example.

In the step of selecting the Output file in the Run Command tool, it's fine to select .csv - this won't work in case of images. Am I assessing this correctly, would there be a solution for this? 

 

Thanks again

The output of the run command has to be a bat file. As this becomes the command it runs.

 

The list of target files doesn't change this if you amend the filter or directory tool to pick up a list of images it should work exactly the same.

 

You will need to amend target folder (which is in the formula tool) as well.

Atom

Can you save the workflow as text I have older version and cannot open?

 

Thanks, Bill

Atom

Nevermind got it tnaks

Alteryx Partner

Hello. Once a script like that runs the "Run Command" tool will return an error saying that the external problem returned an error code:1, which is normal as Return code 1 translates to "One of more files were copied successfully".

How can I "catch" that so my module/analytic app doesn't show me an error upon running?

Asteroid

James,

thank you very much for your very good ideas. You saved my day with the copy-bat solution! Very much appreciated.

Meteoroid

I appreciate the sample workflow, but just wanted to add that the destination path in the MoveCmd formula needs to be surrounded by double quotes if your path or filename has spaces, or you will get an Error code 1 when running the batch file.

 

Great solution!

Meteoroid

I have a similar issue I am trying to resolve

 

I have an excel template that I am trying to create a copy of and dynamically save it into a new folder and populate with my data.  So I will finish the work flow effectively with two outputs

1. Master Template (Remaining blank)

2. New File in the same format as the Master Template but populated with my data, and dynamically named based on the source data

 

Is this possible?

 

Thanks

David

 

Labels