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

Move jpeg files to different folder depending on file names

filipaf4
5 - 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!

 

11 REPLIES 11
jdunkerley79
ACE Emeritus
ACE Emeritus

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)

filipaf4
5 - 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

jdunkerley79
ACE Emeritus
ACE Emeritus

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.

wbyoure1
5 - Atom

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

 

Thanks, Bill

wbyoure1
5 - Atom

Nevermind got it tnaks

JArtNaranjo
7 - Meteor

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?

ulrich_schumann
8 - Asteroid

James,

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

JustinLine
7 - Meteor

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!

DavidBaker84
6 - 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