Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to check for location is accessible and append to location

Tags:

c#

I am trying to figure out if any of the below 3 locations are accessible and append to build location,if multiple locations are accessible pick one of them and bail out if none exit,can anyone provide info on how to do this?

1.BIN-LOC-WiFi-FW\loc_proc\bin

2.loc_proc\pkg\cnss_proc\bin

3.loc_proc_ps\package

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace aputloader
{
    class Program
    {
        static void Main(string[] args)
        {
            string buildlocation = @"\\location\builds784\INTEGRATION\LOC.1.2-00028-Z-1";
            //check if atleast one of the following folders exist and append to buildlocation

            //1.BIN-LOC-WiFi-FW\loc_proc\bin
            //2.loc_proc\pkg\cnss_proc\bin
            //3.loc_proc_ps\package
            //multiple folders exist ,pick one
            //none exist ,bail out

        }
    }
}
like image 773
Ritz Avatar asked Feb 02 '26 19:02

Ritz


1 Answers

Maybe something like this?

if(Directory.Exists("BIN-LOC-WiFi-FW\loc_proc\bin")) 
{
    // This path is a directory

}
else if(Directory.Exists("loc_proc\pkg\cnss_proc\bin")) 
{
    // This path is a directory

}
else if(Directory.Exists("loc_proc_ps\package") 
{
    // This path is a directory

}
else 
{
    Console.WriteLine("No valid folder exists.");
    // Do nothing.
}        
like image 116
Danieboy Avatar answered Feb 04 '26 07:02

Danieboy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!