0

I have following code example in which I want only the file name but its shows the full path.

 public static string pathFolder = System.IO.Directory.GetCurrentDirectory() + "\\SmsFiles\\";               

    public static bool FilesFinish = true;
    static void Main(string[] args)
    {  
        ss = getconnected("COM7");
        Thread.Sleep(10000);
        if(ss)
        { 
        Timer t = new Timer(TimerCallback, null, 0, 4000);
        }

        Console.ReadKey();
    }

      private static void TimerCallback(Object o)
      {
          try
          {

          string[] fileEntries = Directory.GetFiles(pathFolder);

          if (FilesFinish)
          {
            FilesFinish = false;
          foreach (string fileName in fileEntries)
          {
              var Readfile = File.ReadAllLines(fileName).Last();
              string GetNumber = fileName.Substring(0, 11);}

please see below imageenter image description here

Tal Avissar
  • 10,088
  • 6
  • 45
  • 70
Adeel Khan
  • 185
  • 5
  • 15

0 Answers0