I am unsure in how to link the CSV file in which it checks each the column A1 on each row for if it finds one of the images in a different folder it moves on. If it doesn’t, I would like it to remove the row in the csv
Could you explain with more Details what do you need exactly?
In this CSV, it has a column with thousands of image file names as JPG’s. What I would like to do is to check whether these filenames correlate with an image located in a differing folder. Therefore, I understand I need to iterate the CSV creating a for each row but how do I check against a whole folder containing the images
Maybe something like this:
With File.Exist() method you could check if a file exist in a specific folder. Change to check several folders
It was just that file.exist why is it row(0) I would like to check the whole folder if possible
overall really helpful and almost there so thanks. Also, I would like it to delete the specific row if it is not found so how did I add that in for the else statement
What you need is Check if all files in a folder are presente in your CSV? I think it would be easier loop over CSV and then check if file exist in a folder or several folders, it depends of your needs.
I need to loop over the CSV and files in folder but am not sure that’s the issue I am facing
- Get an array of Filenames with Directory.GetFiles() method
- inside foreach loop, check if your file at row(0) is in the Array using LINQ expressions
how do I add a delete row for this as otherwise you have to index it to the specified row? sorry about this
Just play with the “Then-Else”. If your file is present in Array (Count is not Zero), Delete using Remove row Activity, otherwise do something depending your needs.
I am still struggling with this. I want it to add 1 to the row index each time it is successful
I’m understanding your problem but you can use a Continue Activity to Make next Iteration in Then section
But there are multiple file names that need to be removed so it can’t just end the for each loop sorry
create an empty list/array, add filenames to it and finally delete files looping that list/array
I know this is difficult but as that code in the if statement isn’t something I would use how would I go about this? Can you show a template as it just seems to be getting a bit overcomplicated
This doesn’t seem to work as can’t convert integer to data table due to the 0