Loop through zipped subfolders in a folder to extract files matching keywords

UseCase: There are a list of zipped folders inside a folder which have list of files. I want to extract the files from these bunch of zipped folders matching certain keywords.
E.g a folder with date 20210915
list of subfolders inside this folder
ABCDE.zip
ABCDF.zip
ABCDGF.zip etc
Each of these zipped folders have a file matching a kewords ‘ABC’, ‘ABD’, ‘CDE’ etc

Further these files extracted matching keywords needs to be prefixed

Any help would be appreciated!

Hello @NSharma05,

You could unzip the entire zipped folder into a temp location.
And then pull the file you need by using this expression in an Assign Activity

Example:
Let us suppose your Zip file is name ABCDE.zip
You unzip it to a folder C:\temp\ABCDE

Then you use the Assign Activity to get the matching keyword file:

MatchingFiles = Directory.GetFiles("C:\temp\ABCDE folder", keyword*)

where keyword is the variable that is storing the keyword that you want to match. I assume that you already know the keywords you are looking for.

MatchingFiles is a String Array that will return one or more matching files.

You use For Each to loop through the array and process the file

Finally (and optional) you delete the temp folder C:\temp\ABCDE once you have processed all the matching files.

I quite didn’t follow this part of your question.

If your filenames already contain keywords, why do they need to be prefixed?

@AndyMenon Thank you for your reply but i have 100’s of zipped folders which needs to be unzipped.
Case is to search files from these zipped folders matching a keyword, move them into a different folder and then prefix and suffix as per my requirement for a process to pick up these files

Is it possible to share some screenshots explaining your case? That will be more helpful…

Also share a sample file name to be searched(After masking ) and file name needs to renamed…

How about approaching this simplistically.

Come up with a flow to process one Zipped folder to perform the following actions :

  • search files from these zipped folders matching a keyword
  • move them into a different folder
  • and then prefix and suffix as per my requirement

If it works for one zipped file correctly, then RPA must repeat the process you built accurately no matter how many zipped files there are.