How to transfer multiple files from one folder to another based on current date


#1

Hi,
I am new to UI path, I want to know to transfer multiple files from one folder to another based on current date.
I am getting the files but unable to move to another folder using Move file activity

Thanks
Sujitha


#2

Hi
Are you getting any error ?
*Have you checked properly the “From” and “To” arguments in "Properties " pane ?
image


#3


Hey, here is a workaround, I don’t think move file activity works for directories!
If you are trying to move the whole directory use this method. This uses a function called move of the directory class.
Hope this will be helpful to you :slight_smile:
Regards
Niket Ghai


#4

Hi,
yes i have checked properly the pane, I am getting the file but while try to move the file its showing error like
“Move file : Could not find file ‘C:\Users\443919\Documents\UiPath\File trasfer\sdf.docx’.”,
Here i am getting files (sdf.docx) from D folder but why in move activity it showing C folderMain.xaml (9.0 KB)

Please help me out


#5

I think move whole directory then change name of folder

Regards,


#6

Cant move whole directory because directory contains old files too. I need to move only current dated files which generated today.
eg: move from old folder to backup folder


#7

@NagaSujitha Follow attached link its working after downloading file give path in the arguments


#8

@NagaSujitha,

This’s flow:

  • Get all files in directory
  • Your condition then move file

My example: move files.contains(“ea”) to another folder
Main.xaml (6.8 KB)


#9

Hi Chinh,

As you suggested i worked on it using Conditions. Work flow running without any error but, same time file also not transfer to another folder. Main.xaml (9.0 KB)


#10

Hi
in the xaml file you provided —
Please look at this step. for each.
image

following providing your file name not full path of file. ?

dir_info.GetFiles("*.docx").Where(function(file) file.LastWriteTime.Date= DateTime.Now.Date).OrderByDescending(function(d) d.LastWriteTimeUtc).ToArray

so file.ToString is not provding you full path of your DOCX file . Please try to modify the above step .


#11

Hi
In following step please change the “value” to below : this will provide FULL path for “From”

Assing

File item = folder_path &"\"& file.ToString

File(Message box)
Fileitem.ToString

image


#12

Thank you Allurai, It worked.
Thank you all for helping me :slight_smile:


#13

If you you got the solution , Please close the thread as Solution.