954,551 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

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.
:'(

bcm
Junior Poster in Training
64 posts since Aug 2007
Reputation Points: 18
Solved Threads: 0
 
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
Newbie Poster
3 posts since Nov 2007
Reputation Points: 10
Solved Threads: 0
 

please send me the code for the above mentioned one..

melvincmathew
Newbie Poster
3 posts since Nov 2007
Reputation Points: 10
Solved Threads: 0
 

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.

MehdiAnis
Newbie Poster
12 posts since Nov 2007
Reputation Points: 10
Solved Threads: 0
 

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..

melvincmathew
Newbie Poster
3 posts since Nov 2007
Reputation Points: 10
Solved Threads: 0
 

3 years later but thanks for the code!!!
always nice to quickly get a working sample code from a simple google search.

yoann ( www.prodeos.fr )

prodeos
Newbie Poster
1 post since Jan 2010
Reputation Points: 10
Solved Threads: 0
 

I'm glad you got it helpful.

Please do not resurrect old threads. If you have any questions please ask. You are welcome to start your own threads.

Have a look at forum rules .
Please read before posting - http://www.daniweb.com/forums/thread78223.html

Thread Closed.

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You