I attempting to save a file to a specific folder that is begins with the hotels property number. Currently I've manually listed the properties complete folder name in a text file. This is proving to be a management problem that needs to be fixed.
The code I'm using to find and save the file looks like this:
Using reader As New StreamReader("O:\IPSDATA\Property Folder Names.txt") While Not reader.EndOfStream Dim line As String = reader.ReadLine() If line.Contains(propertyNo2) Then hotelFolder = line Exit While End If End While End Using ' setting the path name to save the converted file fileSave = "O:\Revenue Management\Centralized Revenue Management Service\CRMS Hotels\" & hotelFolder & "\Restran\" & propertyNo & "Restran.txt"
You can see a line that looks for the folder using "line.Contains". Is there a way I can do the same thing when I'm looking through a directory? In other words, how can I look through the directory, "O:\Revenue Management\Centralized Revenue Management Service\CRMS Hotels\", find a folder that begins with (as an example) "0213" and then return the full name of that folder in the form of a string?
I'll continue to search the internet. But if you know how, please speak up!