[Solved] Linux and Csharp, Check If File/Folder Doesn’t Exist in Linux, if so, run MKDIR via Csharp SSH – [closed]


This is something I ran into not long ago so trust me on here…

Let’s check out this little guy below:

if(condition == true) 

In a way you’re already answering your question, just not comprehending the syntax. (check it out)

using System;
using System.IO;

namespace StackOverflowQA
{
    class Program
     {

         static void Main(string[] args)
         {
            if(File.Exists(@"C:\Exercise\Derp\"))
             {
               DoWork();
             }
             else
             {
               Console.Out.Writelne("Wrong kid died");
               Console.Write("Enter a key to exit");
               Console.Read();
             }

            private static void DoWork()
            {

              //-- if you get to this point then check out that,
             //    NuGet pkg you're working with (WinSCP) and proceed! :) 
            }
         }

      }
 }

Before even getting into a third-party assembly or library/whatever, I think you need to first create a simple console application to find a file on your machine.

Create the folder I just described in-code and “DoWork();”

Cheers ^_^

2

solved Linux and Csharp, Check If File/Folder Doesn’t Exist in Linux, if so, run MKDIR via Csharp SSH – [closed]