473,396 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Determining Size of a File

In VB.NET I find the IO object very handy in replacing most of the
functionality of the FileSystemObject. One exception, however, is in
determining the size of a file. How can you determine the size of a file in
VB.NET without adding the FileSystemObject to your project?
Jul 21 '05 #1
2 2224
The FileInfo class has a Length property.

Chris
"Phil Galey" <pa*****@starcalif.com.nospam> wrote in message
news:eG*************@tk2msftngp13.phx.gbl...
In VB.NET I find the IO object very handy in replacing most of the
functionality of the FileSystemObject. One exception, however, is in
determining the size of a file. How can you determine the size of a file in VB.NET without adding the FileSystemObject to your project?

Jul 21 '05 #2
Imports System.IO
....

Dim fi As New FileInfo(somepath)

Then get the information from the FileInfo object. In keeping with the
abstraction-of-the-month buzz, the property you want is "Length", not
"Size".
--
Klaus H. Probst, MVP
http://www.vbbox.com/


"Phil Galey" <pa*****@starcalif.com.nospam> wrote in message
news:eG*************@tk2msftngp13.phx.gbl...
In VB.NET I find the IO object very handy in replacing most of the
functionality of the FileSystemObject. One exception, however, is in
determining the size of a file. How can you determine the size of a file in VB.NET without adding the FileSystemObject to your project?

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Luca | last post by:
I have the following problem: I'm developing a system where there are some processes that communicate each other via message queues; the message one process can send to another process is as...
12
by: Raja | last post by:
How to know the buffer size and increase buffer size in c++.
2
by: Phil Galey | last post by:
Using the following, you can determine the size of a file: Dim fi As New IO.FileInfo(<Path to file>) MsgBox(fi.Length) .... but what about the size of a directory? The IO.DirectoryInfo object...
2
by: Phil Galey | last post by:
In VB.NET I find the IO object very handy in replacing most of the functionality of the FileSystemObject. One exception, however, is in determining the size of a file. How can you determine the...
14
by: googler | last post by:
Is there any C library function that returns the size of a given file? Otherwise, is there a way in which file size can be determined in a C program? I need to get this for both Linux and Windows...
2
by: Doug | last post by:
Hi, It looks like the only way to get a size of a file within dot net is to use FileInfo and the Length property. However that only returns the number of bytes in the file which is translating...
9
by: vineeth | last post by:
Hello all, I have come across a weird problem, I need to determine the amount of bytes read from a file, but couldn't figure it out , My program does this : __ file = open("somefile") data =...
13
by: writeson | last post by:
Hi all, I'm writing some code that monitors a directory for the appearance of files from a workflow. When those files appear I write a command file to a device that tells the device how to...
0
by: Cameron Simpson | last post by:
On 10Jul2008 13:20, Manuel Vazquez Acosta <mva.led@gmail.comwrote: | Cameron Simpson wrote: | On 09Jul2008 15:54, Ethan Furman <ethan@stoneleaf.uswrote: | >The solution my team has used is to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.