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.

How to copy a file from one folder to another

haya
8 - Asteroid

Hi,

 

Can you please provide a sample workflow to copy a file from one folder to another folder using alteryx (Kind of taking backup of files).

 

Regards,

Haya

13 REPLIES 13
mbarone
16 - Nebula
16 - Nebula
Ah......I see the issue now.

The macro utilizes the "run command" tool. I thought this tool came with the basic designer license, but perhaps not. Or, you may have to enable it. Can't remember and I'm not at a computer. But that's why the macro isn't available. It doesn't recognize the run command tool that's in the macro.
pbrink
8 - Asteroid

I have the Run Command.

 

Output is a text file?

 

command is xcopy

 

command arguments is first where the files are coming from and the second part is where the files are going, is that correct?

 

Thanks for your help

 

mbarone
16 - Nebula
16 - Nebula

Well I'm at a loss then.  If you have the run command tool I don't know why Designer doesn't recognize the tools within the macro.


At any rate, if you go back up several posts, I have a screen shot of the inside of the macro, complete with comments next to the run command tool.  That should get you right on your way.

amirsemsar
8 - Asteroid

Or you can use python with a function like this: 

 

from ayx import Alteryx
import shutil
import os
import pandas as pd


def archiving(a):
    source=a['filepath'].tolist()
    destination=a['destination'].iloc[0]
    destination=destination.replace('\\','/')
    source=[shutil.copy(each,destination) for each in source]
    dicty={"newfiles":[destination+os.path.basename(each) for each in source]}
    output=pd.DataFrame.from_dict(dicty)
    Alteryx.write(output,1)

df=Alteryx.read("#1")
archiving(df)
Labels