I would like to create an automation which will read numbers from a txt file, after that it will read the names of the files in a specific folder and if any of the previously read number are in any name of the files, it should copy the file to an other folder.
I made the below automation, it does not show error but nothing happen when i start it.
Can you please help me what can be the issue? I think something is with the copying method.
What is the format of the text file? Show us what’s in it.
The Item property of the activity is not an array. For Each is looping through the files, and each iteration of the loop the Item property represents the current file it’s on.
Change Item to CurrentFile. Then change your If condition to CurrentFile = value from the text file (which we still need to see).
However…
Assuming the text file is a CSV you want to use Read CSV to get it into a datatable. Then For Each Row in Datatable, and your if would be File.Exist(CurrentRow(“FileName”).ToString)
You’re trying to look at all the files and see if they’re in the text file. Do it the other way around. Loop through the filenames in the text file and if that file exists in the folder, copy it.