<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net%2FFile_Directory%2FFile</id>
		<title>VB.Net/File Directory/File - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net%2FFile_Directory%2FFile"/>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/File_Directory/File&amp;action=history"/>
		<updated>2026-04-06T00:11:30Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net/File_Directory/File&amp;diff=834&amp;oldid=prev</id>
		<title> в 16:40, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/File_Directory/File&amp;diff=834&amp;oldid=prev"/>
				<updated>2010-05-26T16:40:06Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 16:40, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net/File_Directory/File&amp;diff=835&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/File_Directory/File&amp;diff=835&amp;oldid=prev"/>
				<updated>2010-05-26T12:45:18Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Change file attribute for *.* ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt; &lt;br /&gt;
Imports System.IO&lt;br /&gt;
Module Module1&lt;br /&gt;
    Sub ProcessTree(ByVal Dir As String)&lt;br /&gt;
        Dim DirObj As New DirectoryInfo(Dir)&lt;br /&gt;
        Dim Files As FileInfo() = DirObj.GetFiles(&amp;quot;*.*&amp;quot;)&lt;br /&gt;
        Dim Dirs As DirectoryInfo() = DirObj.GetDirectories(&amp;quot;*.*&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
        Dim Filename As FileInfo&lt;br /&gt;
        For Each Filename In Files&lt;br /&gt;
            Try&lt;br /&gt;
                If (Filename.Attributes And FileAttributes.ReadOnly) Then&lt;br /&gt;
                    Filename.Attributes = (Filename.Attributes And Not FileAttributes.ReadOnly)&lt;br /&gt;
                End If&lt;br /&gt;
            Catch E As Exception&lt;br /&gt;
                Console.WriteLine(&amp;quot;Error changing attribute for {0}&amp;quot;, Filename.FullName)&lt;br /&gt;
                Console.WriteLine(&amp;quot;Error: {0}&amp;quot;, E.Message)&lt;br /&gt;
            End Try&lt;br /&gt;
        Next&lt;br /&gt;
        Dim DirectoryName As DirectoryInfo&lt;br /&gt;
        For Each DirectoryName In Dirs&lt;br /&gt;
            Try&lt;br /&gt;
                ProcessTree(DirectoryName.FullName)&lt;br /&gt;
            Catch E As Exception&lt;br /&gt;
                Console.WriteLine(&amp;quot;Error accessing {0}&amp;quot;, DirectoryName.FullName)&lt;br /&gt;
                Console.WriteLine(&amp;quot;Error: {0}&amp;quot;, E.Message)&lt;br /&gt;
            End Try&lt;br /&gt;
        Next&lt;br /&gt;
    End Sub&lt;br /&gt;
    Sub Main()&lt;br /&gt;
        ProcessTree(&amp;quot;C:\&amp;quot;)&lt;br /&gt;
    End Sub&lt;br /&gt;
End Module&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Delete a file if exist==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt; &lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
Imports System.Collections.Generic&lt;br /&gt;
Imports System.ruponentModel&lt;br /&gt;
Imports System.Drawing.Imaging&lt;br /&gt;
Imports System.Drawing&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
   Shared Sub Main()&lt;br /&gt;
        Dim file_name As String = &amp;quot;test.wmf&amp;quot;&lt;br /&gt;
        &amp;quot; Delete the file if it exists.&lt;br /&gt;
        If Len(Dir$(file_name)) &amp;gt; 0 Then Kill(file_name)&lt;br /&gt;
&lt;br /&gt;
   End Sub &lt;br /&gt;
End Class&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Delete *.Bak under a directory==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt; &lt;br /&gt;
Imports System.IO&lt;br /&gt;
Module Module1&lt;br /&gt;
&lt;br /&gt;
    Sub DeleteFiles(ByVal Dir As String)&lt;br /&gt;
        Dim DirObj As New DirectoryInfo(Dir)&lt;br /&gt;
        Dim Files As FileInfo() = DirObj.GetFiles(&amp;quot;*.bak&amp;quot;)&lt;br /&gt;
        Dim Dirs As DirectoryInfo() = DirObj.GetDirectories(&amp;quot;*.*&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
        Dim Filename As FileInfo&lt;br /&gt;
        For Each Filename In Files&lt;br /&gt;
            Try&lt;br /&gt;
                File.Delete(Filename.FullName)&lt;br /&gt;
                Console.WriteLine(&amp;quot;Deleted {0}&amp;quot;, Filename.FullName)&lt;br /&gt;
            Catch E As Exception&lt;br /&gt;
                Console.WriteLine(&amp;quot;Error deleting {0}&amp;quot;, Filename.FullName)&lt;br /&gt;
                Console.WriteLine(&amp;quot;Error: {0}&amp;quot;, E.Message)&lt;br /&gt;
            End Try&lt;br /&gt;
        Next&lt;br /&gt;
        Dim DirectoryName As DirectoryInfo&lt;br /&gt;
        For Each DirectoryName In Dirs&lt;br /&gt;
            Try&lt;br /&gt;
                DeleteFiles(DirectoryName.FullName)&lt;br /&gt;
            Catch E As Exception&lt;br /&gt;
                Console.WriteLine(&amp;quot;Error accessing {0}&amp;quot;, DirectoryName.FullName)&lt;br /&gt;
                Console.WriteLine(&amp;quot;Error: {0}&amp;quot;, E.Message)&lt;br /&gt;
            End Try&lt;br /&gt;
        Next&lt;br /&gt;
    End Sub&lt;br /&gt;
    Sub Main()&lt;br /&gt;
        DeleteFiles(&amp;quot;C:\&amp;quot;)&lt;br /&gt;
    End Sub&lt;br /&gt;
End Module&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==English File Size==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;  &lt;br /&gt;
Public Class MainClass&lt;br /&gt;
    Public Shared Function ConvertBytes(ByVal Bytes As Long) As String&lt;br /&gt;
        If Bytes &amp;gt;= 1073741824 Then&lt;br /&gt;
            Return Format(Bytes / 1024 / 1024 / 1024, &amp;quot;#0.00&amp;quot;) &amp;amp; &amp;quot; GB&amp;quot;&lt;br /&gt;
        ElseIf Bytes &amp;gt;= 1048576 Then&lt;br /&gt;
            Return Format(Bytes / 1024 / 1024, &amp;quot;#0.00&amp;quot;) &amp;amp; &amp;quot; MB&amp;quot;&lt;br /&gt;
        ElseIf Bytes &amp;gt;= 1024 Then&lt;br /&gt;
            Return Format(Bytes / 1024, &amp;quot;#0.00&amp;quot;) &amp;amp; &amp;quot; KB&amp;quot;&lt;br /&gt;
        ElseIf Bytes &amp;gt; 0 And Bytes &amp;lt; 1024 Then&lt;br /&gt;
            Return Fix(Bytes) &amp;amp; &amp;quot; Bytes&amp;quot;&lt;br /&gt;
        Else&lt;br /&gt;
            Return &amp;quot;0 Bytes&amp;quot;&lt;br /&gt;
        End If&lt;br /&gt;
    End Function&lt;br /&gt;
    Public Shared Sub Main()&lt;br /&gt;
        Dim objInfo As New System.IO.FileInfo(&amp;quot;c:\a.dat&amp;quot;)&lt;br /&gt;
        System.Console.WriteLine(ConvertBytes(objInfo.Length))&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Information==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
Imports System.IO&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
&amp;lt;Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()&amp;gt; _&lt;br /&gt;
Partial Class Form1&lt;br /&gt;
    Inherits System.Windows.Forms.Form&lt;br /&gt;
    &amp;lt;System.Diagnostics.DebuggerStepThrough()&amp;gt; _&lt;br /&gt;
    Private Sub InitializeComponent()&lt;br /&gt;
        Me.txtDisplay = New System.Windows.Forms.TextBox&lt;br /&gt;
        Me.cmdCreate = New System.Windows.Forms.Button&lt;br /&gt;
        Me.cmdChangeDate = New System.Windows.Forms.Button&lt;br /&gt;
        Me.cmdGetInfo = New System.Windows.Forms.Button&lt;br /&gt;
        Me.TextBox1 = New System.Windows.Forms.TextBox&lt;br /&gt;
        Me.SuspendLayout()&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.txtDisplay.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _&lt;br /&gt;
                    Or System.Windows.Forms.AnchorStyles.Left) _&lt;br /&gt;
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)&lt;br /&gt;
        Me.txtDisplay.Location = New System.Drawing.Point(9, 79)&lt;br /&gt;
        Me.txtDisplay.Multiline = True&lt;br /&gt;
        Me.txtDisplay.ReadOnly = True&lt;br /&gt;
        Me.txtDisplay.ScrollBars = System.Windows.Forms.ScrollBars.Vertical&lt;br /&gt;
        Me.txtDisplay.Size = New System.Drawing.Size(280, 168)&lt;br /&gt;
        Me.txtDisplay.TabIndex = 9&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.cmdCreate.Location = New System.Drawing.Point(9, 39)&lt;br /&gt;
        Me.cmdCreate.Size = New System.Drawing.Size(88, 24)&lt;br /&gt;
        Me.cmdCreate.TabIndex = 8&lt;br /&gt;
        Me.cmdCreate.Text = &amp;quot;Create&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.cmdChangeDate.Location = New System.Drawing.Point(201, 39)&lt;br /&gt;
        Me.cmdChangeDate.Size = New System.Drawing.Size(88, 24)&lt;br /&gt;
        Me.cmdChangeDate.TabIndex = 7&lt;br /&gt;
        Me.cmdChangeDate.Text = &amp;quot;Change Date&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.cmdGetInfo.Location = New System.Drawing.Point(105, 39)&lt;br /&gt;
        Me.cmdGetInfo.Size = New System.Drawing.Size(88, 24)&lt;br /&gt;
        Me.cmdGetInfo.TabIndex = 6&lt;br /&gt;
        Me.cmdGetInfo.Text = &amp;quot;Get Info&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.TextBox1.Location = New System.Drawing.Point(9, 11)&lt;br /&gt;
        Me.TextBox1.Size = New System.Drawing.Size(280, 21)&lt;br /&gt;
        Me.TextBox1.TabIndex = 5&lt;br /&gt;
        Me.TextBox1.Text = &amp;quot;c:\myfile.txt&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)&lt;br /&gt;
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font&lt;br /&gt;
        Me.ClientSize = New System.Drawing.Size(298, 259)&lt;br /&gt;
        Me.Controls.Add(Me.txtDisplay)&lt;br /&gt;
        Me.Controls.Add(Me.cmdCreate)&lt;br /&gt;
        Me.Controls.Add(Me.cmdChangeDate)&lt;br /&gt;
        Me.Controls.Add(Me.cmdGetInfo)&lt;br /&gt;
        Me.Controls.Add(Me.TextBox1)&lt;br /&gt;
        Me.Font = New System.Drawing.Font(&amp;quot;Tahoma&amp;quot;, 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))&lt;br /&gt;
        Me.Name = &amp;quot;Form1&amp;quot;&lt;br /&gt;
        Me.Text = &amp;quot;Form1&amp;quot;&lt;br /&gt;
        Me.ResumeLayout(False)&lt;br /&gt;
        Me.PerformLayout()&lt;br /&gt;
    End Sub&lt;br /&gt;
    Friend WithEvents txtDisplay As System.Windows.Forms.TextBox&lt;br /&gt;
    Friend WithEvents cmdCreate As System.Windows.Forms.Button&lt;br /&gt;
    Friend WithEvents cmdChangeDate As System.Windows.Forms.Button&lt;br /&gt;
    Friend WithEvents cmdGetInfo As System.Windows.Forms.Button&lt;br /&gt;
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox&lt;br /&gt;
    Private Sub cmdCreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCreate.Click&lt;br /&gt;
        Try&lt;br /&gt;
            Dim MyFile As New FileInfo(&amp;quot;c:\myfile.txt&amp;quot;)&lt;br /&gt;
            MyFile.Create().Close()&lt;br /&gt;
            Out(&amp;quot;File created.&amp;quot;)&lt;br /&gt;
        Catch err As Exception&lt;br /&gt;
            Out(err.Message)&lt;br /&gt;
        End Try&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub cmdGetInfo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGetInfo.Click&lt;br /&gt;
        Try&lt;br /&gt;
            Dim MyFile As New FileInfo(&amp;quot;c:\myfile.txt&amp;quot;)&lt;br /&gt;
            Out(&amp;quot;Length in bytes: &amp;quot; &amp;amp; MyFile.Length)&lt;br /&gt;
            Out(&amp;quot;Attribute list: &amp;quot; &amp;amp; MyFile.Attributes.ToString)&lt;br /&gt;
            Out(&amp;quot;Stored in: &amp;quot; &amp;amp; MyFile.DirectoryName)&lt;br /&gt;
            Out(&amp;quot;Created: &amp;quot; &amp;amp; MyFile.CreationTime)&lt;br /&gt;
        Catch err As Exception&lt;br /&gt;
            Out(err.Message)&lt;br /&gt;
        End Try&lt;br /&gt;
    End Sub&lt;br /&gt;
    Public Sub Out(ByVal NewText As String) &amp;quot; Utility for displaying information.&lt;br /&gt;
        txtDisplay.Text &amp;amp;= vbNewLine &amp;amp; NewText&lt;br /&gt;
        txtDisplay.SelectionStart = txtDisplay.Text.Length - 1&lt;br /&gt;
        txtDisplay.ScrollToCaret()&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub cmdChangeDate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdChangeDate.Click&lt;br /&gt;
        Try&lt;br /&gt;
            Dim MyFile As New FileInfo(&amp;quot;c:\myfile.txt&amp;quot;)&lt;br /&gt;
            MyFile.LastWriteTime = DateTime.Today.Add(TimeSpan.FromDays(100))&lt;br /&gt;
            Out(&amp;quot;Time updated.&amp;quot;)&lt;br /&gt;
        Catch err As Exception&lt;br /&gt;
            Out(err.Message)&lt;br /&gt;
        End Try&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Time: created, last modified and accessed==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt; &lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.IO&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
   Shared Sub Main()&lt;br /&gt;
         Dim fileName As String&lt;br /&gt;
         fileName = &amp;quot;test.vb&amp;quot;&lt;br /&gt;
         &lt;br /&gt;
      Console.WriteLine( fileName &amp;amp; &amp;quot; exists&amp;quot; )&lt;br /&gt;
      &amp;quot; output when file or directory was created&lt;br /&gt;
      Console.WriteLine(&amp;quot;Created : &amp;quot; &amp;amp; File.GetCreationTime(fileName) )&lt;br /&gt;
      &amp;quot; output when file or directory was last modified&lt;br /&gt;
      Console.WriteLine(&amp;quot;Last modified: &amp;quot; &amp;amp; _&lt;br /&gt;
         File.GetLastWriteTime(fileName) )&lt;br /&gt;
      &amp;quot; output when file or directory was last accessed&lt;br /&gt;
      Console.WriteLine(&amp;quot;Last accessed: &amp;quot; &amp;amp; _&lt;br /&gt;
         File.GetLastAccessTime(fileName) )&lt;br /&gt;
   End Sub &amp;quot; Main&lt;br /&gt;
End Class&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Find Hidden File under a directory==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt; &lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.IO&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
  Shared Sub Main()&lt;br /&gt;
   Dim myDirectory As DirectoryInfo&lt;br /&gt;
    myDirectory = New DirectoryInfo(&amp;quot;C:\&amp;quot;)&lt;br /&gt;
    Dim aFile As FileInfo&lt;br /&gt;
    For Each aFile In myDirectory.GetFiles&lt;br /&gt;
        If (aFile.Attributes And FileAttributes.Hidden) = FileAttributes.Hidden Then&lt;br /&gt;
            Console.WriteLine(&amp;quot;FOUND hidden file named &amp;quot; &amp;amp; aFile.FullName)&lt;br /&gt;
        End If        &lt;br /&gt;
    Next&lt;br /&gt;
   End Sub&lt;br /&gt;
  &lt;br /&gt;
End Class&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Get Files under an Directory and print its Full Name and Length==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt; &lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.IO&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
  Shared Sub Main()&lt;br /&gt;
   Dim myDirectory As DirectoryInfo&lt;br /&gt;
    myDirectory = New DirectoryInfo(&amp;quot;C:\&amp;quot;)&lt;br /&gt;
    Dim aFile As FileInfo&lt;br /&gt;
    For Each aFile In myDirectory.GetFiles&lt;br /&gt;
        Console.WriteLine(&amp;quot;The file named &amp;quot; &amp;amp; aFile.FullName &amp;amp; _&lt;br /&gt;
        &amp;quot; has length &amp;quot; &amp;amp; aFile.Length)&lt;br /&gt;
    Next&lt;br /&gt;
   End Sub&lt;br /&gt;
  &lt;br /&gt;
End Class&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Get Invalid File Name Chars==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt; &lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.IO&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
   Shared Sub Main()&lt;br /&gt;
        For Each ch As Char In Path.GetInvalidFileNameChars()&lt;br /&gt;
            Console.Write(ch &amp;amp; &amp;quot; &amp;quot;)&lt;br /&gt;
        Next ch&lt;br /&gt;
   End Sub &lt;br /&gt;
End Class&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Is it a File or a Directory==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt; &lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.IO&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
   Shared Sub Main()&lt;br /&gt;
         Dim fileName As String&lt;br /&gt;
         fileName = &amp;quot;test.vb&amp;quot;&lt;br /&gt;
         &lt;br /&gt;
         If File.Exists(fileName) Then&lt;br /&gt;
            Console.WriteLine( &amp;quot;File&amp;quot;)&lt;br /&gt;
         ElseIf Directory.Exists(fileName) Then&lt;br /&gt;
            Console.WriteLine( &amp;quot;Directory&amp;quot;)&lt;br /&gt;
         Else&lt;br /&gt;
            Console.WriteLine( &amp;quot;File for dir does not exist&amp;quot;)&lt;br /&gt;
         End If&lt;br /&gt;
   End Sub &amp;quot; Main&lt;br /&gt;
End Class&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Update file create time, last access time and last write time==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt; &lt;br /&gt;
Imports System.IO&lt;br /&gt;
Module Module1&lt;br /&gt;
    Sub Main()&lt;br /&gt;
       Try&lt;br /&gt;
           Dim FileObj As New FileInfo(&amp;quot;test.dat&amp;quot;)&lt;br /&gt;
           FileObj.CreationTime = DateTime.Now&lt;br /&gt;
           FileObj.LastAccessTime = DateTime.Now&lt;br /&gt;
           FileObj.LastWriteTime = DateTime.Now&lt;br /&gt;
           Console.WriteLine(&amp;quot;test.dat date and time updated&amp;quot;)&lt;br /&gt;
       Catch Ex As Exception&lt;br /&gt;
           Console.WriteLine(&amp;quot;Error updating test.dat  &amp;quot; &amp;amp; Ex.Message)&lt;br /&gt;
       End Try&lt;br /&gt;
    End Sub&lt;br /&gt;
End Module&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>