• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

A Simple Script

So, enough with the philosophy and overview! It's time to show you a practical example of what I've been talking about. Here is a script that examines all the files in a given directory (folder) and displays the total size of all the files, in bytes:

 1            ' script0101.vbs 
 2            ' total up space used in a given directory
 3    dir = "C:\"
 4
 5    set Fsys = CreateObject("Scripting.FileSystemObject")
 6    totsize = 0
 7    for each file in Fsys.GetFolder(dir).Files
 8        totsize = totsize + file.size
 9    next
10    wscript.echo "The total size of the files in" , dir, "is" , totsize


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint