Hi,
I’m getting the error “Move File: Value cannot be null. (Parameter ‘path1’)”
I’m trying to create folders for files that are within the folder called files. I have files that are named differently and the data comes from an excel file. I want my process to move the file to the folder if it exists but if the folder doesn’t exist, then it should create the folder and then move the file to that folder. Main - Copy.xaml (12.6 KB)
Document2- Temp1
Temp2 -picture
Temp3- pdf file
image-Temp4
You haven’t initialized any path to the SourceFilePath variable. If it is empty then where the bot will the files from the path.
Check the folder path exist or not in Folder exist activity. This activity give bool value.
Check the bool value with If condition Bool = True, In then block use create folder activity to create the folder.
Use read range workbook activity to read the data from the excel.
Take an assign activity and store the files in a array variable by Directory.getfiles(“Give Path here”)
Use for each row in datatable activity to iterate the rows in datatable.
Inside loop use if condition to check the array variable and row value equal.
If equal in then block use the Move file activity to move from source to the destination folder.
I have do the workflow, check the below workflow Main.xaml (16.9 KB)
- Step1 -> Read the excel and stored in a datatable by using read range workbook activity.
- Step2 -> Use assign activity and create a array variable to store the files in the folder
-> Assign -> Files (Array) = Directory.GetFiles("Give the folder path here")
- Step3 -> Use for each row in datatable to iterate the datatable
- Step4 -> Use for each loop to iterate the Files(Array) variable to iterate the every file in the folder
- Step4 -> Use assign activity to store the file name with out extension
-> Assign -> FileName (String) = System.IO.Path.GetFileNameWithoutExtension(currentItem.ToString)
- Step 5 -> Compare the Current row in for each row in datatable with the file name
-> If -> Currentrow("Column name").toString.equals(FileName)
-> In then block give the move file activity to move the current file to another folder