Robson Amaral

Robson Amaral

  • NA
  • 132
  • 17.3k

Question: Find the file in the specified path

Apr 19 2018 12:12 PM
How do I get the files that have .cpv extension in my path:
\\S3A601\ftp@secretaria\bank\Exit_SDPJ\test
 
How to adapt in my code?
 
Here's my code:
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.ComponentModel;  
  4. using System.Data;  
  5. using System.Diagnostics;  
  6. using System.IO;  
  7. using System.Linq;  
  8. using System.ServiceProcess;  
  9. using System.Text;  
  10. using System.Threading.Tasks;  
  11. using System.Timers;  
  12.   
  13. namespace ServicoProcessamentoComprovantes  
  14. {  
  15.     public partial class Service1: ServiceBase  
  16.     {  
  17.         private Timer timer1 = null;  
  18.         public Service1 ()  
  19.         {  
  20.             InitializeComponent ();  
  21.         }  
  22.   
  23.         protected override void OnStart (string [] args)  
  24.         {  
  25.             StreamWriter write = new StreamWriter (@ "c: \ ServiceBanestes.txt"true);  
  26.             write.WriteLine ("Service started:" + DateTime.Now.ToString ());  
  27.             write.Flush ();  
  28.             write.Close ();  
  29.         }  
  30.         protected override void OnStop ()  
  31.         {  
  32.             StreamWriter write = new StreamWriter (@ "c: \ ServiceBanestes.txt"true);  
  33.             write.WriteLine ("Process Stopped:" + DateTime.Now.ToString ());  
  34.             write.Flush ();  
  35.             write.Close ();  
  36.         }  
  37.     }  
  38. } 

Answers (2)