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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check database size

Status
Not open for further replies.

daillest319

Programmer
Apr 9, 2012
29
0
0
US
Hi,
Was wondering if someone can help I'm attempting to write a vbscript to check if the file size is bigger than 9,000KB if it is then msg me back the file is bigger than 9,000kb else the file is under 9,000kb.I plan on emailing myself but im fine with the email portion.



Code:
 Dim maxFileSize
 maxFileSize     =     9,000 
  
 Set objFSO = createobject("Scripting.FileSystemObject") 
 strFile= "C:\Test\Database1.accdb"

' need to check if size is greater than 9,000kb
             If strFile.size > maxFileSize Then 
			 wscript.echo "file is bigger than 9,000kb"
			 else
                             wscript.echo "file is not bigger than 9,000kb"
             End If 
         End If
 
.size returns the file size in bytes, not kilobytes. Also, remove the commas from all numbers.

Code:
maxFileSize = 9 * 1024 * 1024  [green]'9KB[/green]

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top