Public Class Form1
Inherits System.Windows.Forms.Form
Function kontrol()
If CheckBox1.Checked = False And DirListBox1.Path = DirListBox2.Path Then
kontrol = 1
MsgBox("Bu durumda kopyalama yapılamaz", MsgBoxStyle.Information, "UYARI")
Else
kontrol = 0
End If
End Function
Public Function tarih()
Dim ad1, ad2, ad3, ad4 As String
Dim s, t, u
ad4 = Today
s = Len(ad4)
t = InStr(1, ad4, "/")
If t = 0 Then tarih = Today : GoTo son
u = InStr(t, ad4, "/") + t + 1
ad1 = Mid$(ad4, 1, t - 1)
ad2 = Mid$(ad4, t + 1, u - (t + 1))
ad3 = Mid$(ad4, u + 1, s - u)
tarih = ad2 & "." & ad1 & "." & ad3
son:
End Function
Function klasorkontrol()
Dim c As String
Dim d As Single
If DirListBox1.Path DirListBox2.Path Then ChDir(DirListBox2.Path) ' hedef dizin
c = Dir("*.*", 16) 'ilk klasor
While c "" ' tarihe ait klasor varmı
If c = tarih() Then d = 1 Else d = 0
c = Dir()
End While
If CheckBox1.Checked = True And d = 0 Then ' tarihe ait klasor yoksa ac
If DirListBox1.Path DirListBox2.Path Then ChDir(DirListBox2.Path)
MkDir(tarih) ' hedefe klasor acıldı
End If
ChDir(DirListBox1.Path)
End Function
Function hedef()
If CheckBox1.Checked = True Then
klasorkontrol()
hedef = DirListBox2.Path & "\" & tarih() & "\"
MsgBox(hedef)
Else
hedef = DirListBox2.Path & "\"
End If
End Function
Function kaynak()
kaynak = DirListBox1.Path & "\"
End Function
Public Function kopyala()
Timer1.Enabled = False
Dim dosya, hedef1, hedef2 As String
MsgBox(kaynak)
MsgBox(hedef)
ChDir(DirListBox1.Path)
dosya = Dir("*.*")
While dosya ""
ChDir(DirListBox1.Path)
FileCopy(kaynak() & dosya, hedef() & dosya)
Kill(kaynak() & dosya)
FileListBox1.Refresh()
FileListBox2.Refresh()
'listele()
ListBox1.Items.Add(kaynak() & dosya & " kaynağından " & hedef1 & " hedefine kopyalama başarı ile tamamlandı..")
ChDir(DirListBox1.Path)
dosya = Dir("*.*")
End While
Timer1.Enabled = True
End Function
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents DirListBox1 As Microsoft.VisualBasic.Compatibility.VB6.DirListBox
Friend WithEvents DirListBox2 As Microsoft.VisualBasic.Compatibility.VB6.DirListBox
Friend WithEvents DriveListBox1 As Microsoft.VisualBasic.Compatibility.VB6.DriveListB ox
Friend WithEvents DriveListBox2 As Microsoft.VisualBasic.Compatibility.VB6.DriveListB ox
Friend WithEvents FileListBox1 As Microsoft.VisualBasic.Compatibility.VB6.FileListBo x
Friend WithEvents FileListBox2 As Microsoft.VisualBasic.Compatibility.VB6.FileListBo x
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
Friend WithEvents Timer1 As System.Windows.Forms.Timer
Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem3 As System.Windows.Forms.MenuItem
Friend WithEvents Button3 As System.Windows.Forms.Button
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Me.DirListBox1 = New Microsoft.VisualBasic.Compatibility.VB6.DirListBox
Me.DirListBox2 = New Microsoft.VisualBasic.Compatibility.VB6.DirListBox
Me.DriveListBox1 = New Microsoft.VisualBasic.Compatibility.VB6.DriveListB ox
Me.DriveListBox2 = New Microsoft.VisualBasic.Compatibility.VB6.DriveListB ox
Me.FileListBox1 = New Microsoft.VisualBasic.Compatibility.VB6.FileListBo x
Me.FileListBox2 = New Microsoft.VisualBasic.Compatibility.VB6.FileListBo x
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.ListBox1 = New System.Windows.Forms.ListBox
Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
Me.CheckBox1 = New System.Windows.Forms.CheckBox
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.MainMenu1 = New System.Windows.Forms.MainMenu
Me.MenuItem1 = New System.Windows.Forms.MenuItem
Me.MenuItem2 = New System.Windows.Forms.MenuItem
Me.MenuItem3 = New System.Windows.Forms.MenuItem
Me.Button3 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'DirListBox1
'
Me.DirListBox1.IntegralHeight = False
Me.DirListBox1.Location = New System.Drawing.Point(0, 48)
Me.DirListBox1.Name = "DirListBox1"
Me.DirListBox1.Size = New System.Drawing.Size(136, 64)
Me.DirListBox1.TabIndex = 0
'
'DirListBox2
'
Me.DirListBox2.IntegralHeight = False
Me.DirListBox2.Location = New System.Drawing.Point(136, 48)
Me.DirListBox2.Name = "DirListBox2"
Me.DirListBox2.Size = New System.Drawing.Size(136, 64)
Me.DirListBox2.TabIndex = 1
'
'DriveListBox1
'
Me.DriveListBox1.Location = New System.Drawing.Point(0, 24)
Me.DriveListBox1.Name = "DriveListBox1"
Me.DriveListBox1.Size = New System.Drawing.Size(136, 21)
Me.DriveListBox1.TabIndex = 2
'
'DriveListBox2
'
Me.DriveListBox2.Location = New System.Drawing.Point(136, 24)
Me.DriveListBox2.Name = "DriveListBox2"
Me.DriveListBox2.Size = New System.Drawing.Size(136, 21)
Me.DriveListBox2.TabIndex = 3
'
'FileListBox1
'
Me.FileListBox1.Location = New System.Drawing.Point(0, 112)
Me.FileListBox1.Name = "FileListBox1"
Me.FileListBox1.Pattern = "*.*"
Me.FileListBox1.Size = New System.Drawing.Size(136, 69)
Me.FileListBox1.TabIndex = 4
'
'FileListBox2
'
Me.FileListBox2.Location = New System.Drawing.Point(136, 112)
Me.FileListBox2.Name = "FileListBox2"
Me.FileListBox2.Pattern = "*.*"
Me.FileListBox2.Size = New System.Drawing.Size(136, 69)
Me.FileListBox2.TabIndex = 5
'
'Button1
'
Me.Button1.Font = New System.Drawing.Font("Sylfaen", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(162, Byte))
Me.Button1.Location = New System.Drawing.Point(312, 16)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(56, 23)
Me.Button1.TabIndex = 6
Me.Button1.Text = "Başlat"
'
'Button2
'
Me.Button2.Font = New System.Drawing.Font("Sylfaen", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(162, Byte))
Me.Button2.Location = New System.Drawing.Point(384, 16)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(56, 23)
Me.Button2.TabIndex = 7
Me.Button2.Text = "Durdur"
'
'ListBox1
'
Me.ListBox1.Location = New System.Drawing.Point(0, 184)
Me.ListBox1.Name = "ListBox1"
Me.ListBox1.Size = New System.Drawing.Size(480, 56)
Me.ListBox1.TabIndex = 8
'
'Timer1
'
Me.Timer1.Interval = 1000
'
'CheckBox1
'
Me.CheckBox1.Font = New System.Drawing.Font("Sylfaen", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(162, Byte))
Me.CheckBox1.Location = New System.Drawing.Point(288, 64)
Me.CheckBox1.Name = "CheckBox1"
Me.CheckBox1.Size = New System.Drawing.Size(192, 104)
Me.CheckBox1.TabIndex = 9
Me.CheckBox1.Text = "Gunun Tarihine gore Klasor ac"
'
'Label1
'
Me.Label1.Font = New System.Drawing.Font("Sylfaen", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(162, Byte))
Me.Label1.Location = New System.Drawing.Point(0, 0)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(136, 23)
Me.Label1.TabIndex = 10
Me.Label1.Text = "KAYNAK"
'
'Label2
'
Me.Label2.BackColor = System.Drawing.SystemColors.ActiveBorder
Me.Label2.Font = New System.Drawing.Font("Sylfaen", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(162, Byte))
Me.Label2.Location = New System.Drawing.Point(136, 0)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(136, 23)
Me.Label2.TabIndex = 11
Me.Label2.Text = "HEDEF"
'
'MainMenu1
'
Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() )
'
'MenuItem1
'
Me.MenuItem1.Index = 0
Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() )
Me.MenuItem1.Text = "Menu"
'
'MenuItem2
'
Me.MenuItem2.Index = 0
Me.MenuItem2.Text = "Cıkış"
'
'MenuItem3
'
Me.MenuItem3.Index = 1
Me.MenuItem3.Text = "Hakkında"
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(328, 152)
Me.Button3.Name = "Button3"
Me.Button3.TabIndex = 12
Me.Button3.Text = "Button3"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(482, 243)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.CheckBox1)
Me.Controls.Add(Me.ListBox1)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.FileListBox2)
Me.Controls.Add(Me.FileListBox1)
Me.Controls.Add(Me.DriveListBox2)
Me.Controls.Add(Me.DriveListBox1)
Me.Controls.Add(Me.DirListBox2)
Me.Controls.Add(Me.DirListBox1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWind ow
Me.Menu = Me.MainMenu1
Me.Name = "Form1"
Me.Text = "KOPYALA"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub DirListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DirListBox1.SelectedIndexChanged
FileListBox1.Path = DirListBox1.Path
End Sub
Private Sub DriveListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DriveListBox1.SelectedIndexChanged
DirListBox1.Path = DriveListBox1.Drive
End Sub
Private Sub DriveListBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DriveListBox2.SelectedIndexChanged
DirListBox2.Path = DriveListBox2.Drive
End Sub
Private Sub DirListBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DirListBox2.SelectedIndexChanged
FileListBox2.Path = DirListBox2.Path
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If kontrol() = 1 Then GoTo son
If MsgBox("Bu klasordeki taşımayı onaylıyor musunuz?", MsgBoxStyle.YesNo, "UYARI") = MsgBoxResult.Yes Then
Timer1.Enabled = True
DirListBox1.Enabled = False
DriveListBox1.Enabled = False
DirListBox2.Enabled = False
DriveListBox2.Enabled = False
CheckBox1.Enabled = False
End If
son:
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
kopyala()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled = False
DirListBox1.Enabled = True
DriveListBox1.Enabled = True
DirListBox2.Enabled = True
DriveListBox2.Enabled = True
CheckBox1.Enabled = True
End Sub
Selam yazdığım program guzel calışıyor ama anlamadığım
bir yer var.
Gunluk klasor ac deyip aynı dizini sectiğimde farklı dizinde olduğu gibi yeni klasor acıp hedefi farklı yer olarak secip kopyalama yapması gerekiyor.
Ama hata veriyor.Cozemedim.
Sadece burada hata alıyorum. Diğer işlemleri gayet guzel yapıyor.
Bana hatayı soylerseniz sevinirim.
__________________
program da ufak bir hata
Programlama0 Mesaj
●22 Görüntüleme
- ReadBull.net
- Programlama ve Yazılım
- Programlama
- program da ufak bir hata