Free Trial

Alteryx Designer Desktop Discussions

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

Move files without using Run Command tool

binay2448
11 - Bolide

Please suggest how can we move files in different folder without using Run Command tool. 

We need to move file from a folder to Archive folder after processing.   

4 REPLIES 4
messi007
15 - Aurora
15 - Aurora

@binay2448,

 

You can move files with blob tools.

Please see below,

I add a comment on the workflow to explain the steps,

messi007_0-1633600529026.png

 

Attached the workflow,

 

Regards,

Prime.PNG

 

binay2448
11 - Bolide

Hi @messi007,

 

I want to move the files from source folder to destination folder. your workflow copy files from source folder and pasting it to destination folder. Not deleting it form the source folder. 

 

messi007
15 - Aurora
15 - Aurora

@binay2448,

 

As my knowledge you can't do this without cmd.

 

Regards,

Pawel_Lula
5 - Atom

You can do move/"cut and paste" using Python script.

 

#################################
import os
import shutil
from glob import iglob


#################################
def move_all_latest_files(source_dir, destination_dir):
files = os.listdir(source_dir)

if not files:
print(f"No files found in {source_dir}. Skipping processing.")
return
'''
for filename in files:
source_file = os.path.join(source_dir, filename)
destination_file = os.path.join(destination_dir, filename)
shutil.move(source_file, destination_file)
'''
for root, directories, files in os.walk(source_dir):
for filename in files:
source_file = os.path.join(root, filename)
destination_file = os.path.join(destination_dir, os.path.relpath(source_file, source_dir))
shutil.move(source_file, destination_file)
print(f"Moved all files from {source_dir} to {destination_dir}")


#################################
source_dir = r'\\Your_Source_Path'
destination_dir = r'\\Destination_Path'

move_all_latest_files(source_dir, destination_dir)

Labels
Top Solution Authors