Alteryx Designer Desktop Discussions

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

How to copy files from one folder to another folder

Kottapally_Ramesh
7 - Meteor

I need take backup of few files everyday.

I have to copy few selected files everyday from one folder and create a new folder with current date (YYYY_MM_DD) and paste those files in this new folder. 

Could someone help me how can i achieve this ...

2 REPLIES 2
amirsemsar
8 - Asteroid

Alternatively 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