Check if excel files in a folder are missing against an excel list

Hi guys
So like the title says, I’ve been looking for the best way to go through a folder, with multiple sub-folders, and check and see if it contains the correct files, and if there is a missing a file, Id like to know which one. The file names are in an excel file. I’m looking for the quickest and most dynamic way to do this, what I’ve done so far hasn’t been too dynamic.

Also the excel file names are repetitive, but their parent folders are different. (So I cant just loop through all the items on the excel list, and see if the parent folder contains those exact files)

For example in the excel, it would look like this-
Column A-------------Column B-------------Column C
Parent Directory----Sub directory---------File/excel Name
Column A-------------Column B-------------Column C
July 2020--------------Folder1---------------Report1
July 2020--------------Folder1---------------Report2
July 2020--------------Folder1---------------Report3
July 2020--------------Folder2---------------Report1
August 2020----------Folder1---------------Report1

The way I did it was to cut a certain portion of the excel list by sub directory, add those items to a text file, then I took that text file and checked if it specifically contained the files in that sub directory folder. pretty much the opposite of dynamic, as there are about 13 other folders I would have to copy+edit that sequence to accommodate for it.

Any tips or helps would be much appreciated.

Hi @Barry_Sturgeon,

You can concatenate the values in ColumnA, B and C with “/” so you get “July 2020/Folder1/Report1” and then use Directory.Exists method which returns a boolean. This will help you to determine if a file is missing.

For looping you can use For each row and you can add the missing folder path into a collection which you can use later.
Happy coding! :slight_smile:

Thanks mate, did what you said but I used the Path Exists Activity, worked nicely.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.