Checking if a folder exists in a directory - known string and randomised characters in the name

Hi guys, I have referenced How to check if a file exist inside a folder and then get the filename for that specific file and move the file to another folder

But needing a bit of additional help.

My folder name I need to look for will contain a known string plus randomised additional characters after.

I thought an IF statement containing: Directory.getDirectories(Folder).Contains(variablename + “*”) would work, but no such luck.

Is there a way to search for a specific string plus wildcards after?


Directory.getdirectories(folder) returns the array of strings
If i understand your requirement correctly then your condition is like you need to find files inside folder which are start with variablename(?)

If it is so then you just need to following
Arraypath = directories.getdirectories(folder)
Foreach path in arraypath
If path.startwith(variablename)
//Correct file
//Check next path


You may want to use Regular Expressions IsMatch that returns true or false

Regex.IsMatch(Filename,knownstring+"+") - check the filename that has knownstring from the start

Regex.IsMatch(item,"^"+Knownstring+"+") - check the filename that has knownstring from the
start, middle or end.

Attached working workflow for your reference.
CheckPartOfFileName.xaml (7.6 KB)