Hello All,
I wounder if the following is possible as I have a situation where this would be useful.
let says I have a variable called $ListOfFiles that reads in a text file containing the names of 8 files for example.
Next I do this
foreach ($File in $ListOfFiles) {
Do some stuff
}
Now the thing is the text file containing the list of files can contain wild card entries entries like so
File1.txt
File2.txt
SomeOtherFile.doc
MyFile*
YetAnotherFile.xls
Therefore in the above "do some stuff" section I need to read in all files which have the * wild card at the end of their name i.e.
if ($File -match "\*$") {GCI \Dir1\$File etc.........}
I need to process these additional files (let's say there are 10 which start MyFile) in the same manner I am processing the foreach $file on $ListOfFiles
I believe the $LostOfFiles is read in once at the start
So is there any easy way my be Clear-Variable ListOfFiles then += to make my single foreach loop process all files?
Thanks
Ernie