DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   VB.NET (http://www.daniweb.com/forums/forum58.html)
-   -   Finding file size (http://www.daniweb.com/forums/thread89365.html)

bcm Sep 12th, 2007 7:09 am
Finding file size
 
Can any one give me code for finding size of my log file using VB.NET????
Also I want the code to make my log file of 1KB only and not more than that.
:'(

melvincmathew Nov 19th, 2007 9:08 am
Re: Finding file size
 
Quote:

Originally Posted by bcm (Post 432775)
Can any one give me code for finding size of my log file using VB.NET????
Also I want the code to make my log file of 1KB only and not more than that.
:'(


I want vb.net code for getting file size for a particular log file and delete data based on date if the file size exceeds the limit.

melvincmathew Nov 19th, 2007 9:09 am
Re: Finding file size
 
please send me the code for the above mentioned one..

MehdiAnis Nov 19th, 2007 9:53 am
Re: Finding file size
 
To Get File Size:
=============

Imports System.IO

Private Function GetFileSize(ByVal MyFilePath As String) As Long
Dim MyFile As New FileInfo(MyFilePath)
Dim FileSize As Long = MyFile.Length
Return FileSize
End Function


DELETE COMMAND:
============
MyFile.Delete()

Make sure the file is not ReadOnly, AlreadyInUse B4 deleting, or u get exception.

melvincmathew Nov 20th, 2007 6:43 am
Re: Finding file size
 
Thanks for the code

I need the code for opening the file and deleting based on date..

please help me.. the other code was really helpfull..


All times are GMT -4. The time now is 10:39 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC