Dear All,
i want to cut all files 2 minute before from the current time(more than 2 minute old file) and paste to another path
please see my code
Imports System
Imports System.Data
Imports System.Data.Sql
Imports System.Data.SqlClient
Imports System.Math
Imports System.Xml
Imports System.Configuration
Imports System.IO
Imports System.Net
Imports System.Timers
Imports System.Globalization
Public Class Form1
Dim myReader As SqlDataReader
Dim SQL As String
Dim dr As SqlDataReader
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Function fixQuotes(ByVal theString As String) As String
fixQuotes = Replace(theString, "'", "''")
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Call Copyinifiles()
Timer1.Enabled = True
End Sub
Private Sub Copyinifiles()
Dim FileToCopy As String
Dim NewCopy1 As String
Try
Dim fileEntries As String() = Directory.GetFiles("\\192.192.1.26\f1\", "*.ini")
For Each FileToCopy In fileEntries
Dim ImageName = FileToCopy.Split("\")
NewCopy1 = "\\192.192.2.22\e$\f1\" & ImageName(5)
If (System.IO.File.Exists(NewCopy1)) = True Then
Else
System.IO.File.Copy(FileToCopy, NewCopy1)
End If
Next
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Label1.Text = "ini Files Folder Last Updated at " & Now()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Timer1.Interval = 120000
Call Copyinifiles()
End Sub
End Class