Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use vbscript to get filesize? 1

Status
Not open for further replies.

ddelport

Technical User
Jan 24, 2004
27
ZA
See the search facility is not working!?

I want to run a procedure that is dependent on the evaluation of two files' sizes. As the one grow it's larger size will be used as condition to update the second file. This I need to build in an Access procedure but I don't know vbscript that well. My idea is to get the file sizes using the latter and put these values in variables respectively. Now I can base an IF-statement on this and get on with it. Anybody got me a suggestion how to operate this vbscript function?
 
Try something like:

Function FileSize()
X = FileLen("C:\ChaZ.Txt")
MsgBox X
End Function

ChaZ


"When religion and politics ride in the same cart...the whirlwind follows."
Frank Herbert
 
Thanx Chaz! Didn't know about that one. I suppose I can get along without the help of vbscript afterall! I have, in the meantime, found another alternative as well - just for info, but pleeze help me right if the following is wrong (it works in practise though) :

dim flsysobj, thefile,thesize
Set flsysobj = CreateObject("Scripting.FileSystemObject")
Set thefile = flsysobj.getfile("c:\file.xyz")
thesize = thefile.size 'etc...
 
Would seem OK I suppose, but if all you need is the file size, I suppose you could get it with out using a module of any kind.

ChaZ

"When religion and politics ride in the same cart...the whirlwind follows."
Frank Herbert
 
Yeah, thanks, and your's takes less time AND space...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top