'''' ''''LinkLabel1 '''' Me.LinkLabel1.Location = New System.Drawing.Point(296, 200) Me.LinkLabel1.Name = "LinkLabel1" Me.LinkLabel1.Size = New System.Drawing.Size(144, 23) Me.LinkLabel1.TabIndex = 10 Me.LinkLabel1.TabStop = True Me.LinkLabel1.Text = "http://www.wgscd.com" '''' ''''Form1 '''' Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14) Me.ClientSize = New System.Drawing.Size(464, 238) Me.Controls.Add(Me.LinkLabel1) Me.Controls.Add(Me.CheckBox1) Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.ProgressBar1) Me.Controls.Add(Me.Label1) Me.Controls.Add(Me.Button3) Me.Controls.Add(Me.TextBox2) Me.Controls.Add(Me.ComboBox1) Me.Controls.Add(Me.Button2) Me.Controls.Add(Me.TextBox1) Me.Controls.Add(Me.Button1) Me.Menu = Me.MainMenu1 Me.Name = "Form1" Me.Text = "批量重命名 wgscd 2005" Me.ResumeLayout(False) End Sub #End Region Dim Path As String = "" Dim Filter As String = "*.*" Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Filter = Me.ComboBox1.SelectedItem Dim dir As DirectoryInfo Path = Me.TextBox1.Text If Path <> "" AndAlso Me.ComboBox1.Text <> "" Then '''' If Me.TextBox1.Text.Trim.Length > 6 Then '''' MsgBox("文件类型错误") '''' Exit Sub '''' End If Dim D As New DirectoryInfo("Temp") If D.Exists = False Then D.Create() End If dir = New DirectoryInfo(Me.TextBox1.Text) Dim lenth As Integer = dir.GetFiles(Filter).Length If lenth > 0 Then Me.ProgressBar1.Value = 0 Me.ProgressBar1.Maximum = lenth + 1 Me.Label2.Text = "正在复制到临时目录。。。" Dim fi As FileInfo Dim i As Integer = 1 For Each fi In dir.GetFiles(Filter) Dim Temp As String = fi.Name Dim Extention As String = fi.Extension fi.CopyTo("Temp\" & i & Extention, True) fi.Delete() i += 1 Me.ProgressBar1.Value = i Next Me.ProgressBar1.Value = 0 Me.Label2.Text = "复制到临时目录完成" Me.Label2.Text = "正在删除临时文件。。。" dir = New DirectoryInfo("Temp") If dir.GetFiles(Filter).Length Then Dim fi2 As FileInfo Dim j As Integer = 1 For Each fi2 In dir.GetFiles(Filter) Dim Temp As String = fi2.Name Dim Extention As String = fi2.Extension fi2.CopyTo(Path & "\" & j & Extention, True) fi2.Delete() j += 1 Me.ProgressBar1.Value = j Next Me.Label2.Text = "处理完成" If Me.CheckBox1.Checked Then Dim p As New Process p.Start(Path) End If End If
Else : Exit Sub End If
Else MsgBox("请选择设置操作路径和要文件类型") End If End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.TextBox1.Text = System.Environment.GetFolderPath(Environment.SpecialFolder.MyPictures) Me.ComboBox1.Items.AddRange(New String() {"*.*", "*.jpg", ".gif", "*.bmp", "*.tif", "*.png", "*.html", "*.htm", "*.asp", "*.aspx"}) ComboBox1.SelectedIndex = 1 TextBox2.Text = "例如*.jsp" End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.E 上一页 [1] [2] [3] 下一页 |