How to move all files in a folder to another folder


#1

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


Move directory did not work
#2

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


#3

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


#4

thank you @vikas_reddy_Vicky
@ddpadil


#5

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)


Move/Delete a directory/folder
Move Directory activity
#6

hi,

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


#7

can you attach your workflow please.


#8

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


#9

Hi @Venkatesh,

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

regards,
Vikas reddy


#10

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


#11

Hi @vikas_reddy_Vicky,

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


#12

but that folder is empty


#13

try checking the box ‘Overwrite’ in Move file activity


#14

still getting that error


#15

can you attach xaml


#16

Main (2).xaml (8.4 KB)


#17

Thanks @vikas_reddy_Vicky,

I moved it by using a substring


#18

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

Regards,
Vikas Reddy


#19

your code is not able to get folder…


#20

could you please be elaborate which folder are you referring to

Regards,
Vikas