How to move all files in a folder to another folder

how to move all files in a folder to another folder . if user gives the path of the source folder as well as destination folder

hi @shivamrana,

let From folder be Y, To folder be Z
str= directory.getfiles(Y)
for each item in str
Use ‘Move File’ activity

regards,
Vikas Reddy

9 Likes

Hi @shivamrana ,
just follow up @vikas_reddy_Vicky.
FYI attaching workflow. :slight_smile:copyfilefolder.zip (2.2 KB)

2 Likes

thank you @vikas_reddy_Vicky
@ddpadil

Try this activity if you want to, you just have to pass the source and destination(should not exisit) folder. I created for myself as I needed for bulk activities.Please test before you implment.

MoveDirectory.Activities.1.0.0.nupkg (42.7 KB)

1 Like

hi,

i tried to do it but i’m getting an error:
value of 1 dimensional string cannot be converted into string

can you attach your workflow please.

project.json (235 Bytes)
Main.xaml (5.7 KB)

1 Like

Hi @Venkatesh,

Return type of the variable used is genricvalue convert it to string array.

regards,
Vikas reddy

1 Like

I did changes in your workflow.
Check now.Main (2).xaml (5.9 KB)

Hi @vikas_reddy_Vicky,

Its working, but i’m getting an error that 'cannot create a file that already exists"

but that folder is empty

try checking the box ‘Overwrite’ in Move file activity

still getting that error

can you attach xaml

Main (2).xaml (8.4 KB)

Thanks @vikas_reddy_Vicky,

I moved it by using a substring

Try this
Main (2) (1).xaml (9.1 KB)

Regards,
Vikas Reddy

1 Like

your code is not able to get folder…

could you please be elaborate which folder are you referring to

Regards,
Vikas