Documention for: sizedir.r
Created by: btiffin
on: 5-May-2007
Last updated by: btiffin on: 5-May-2007
Format: html
Downloaded on: 19-Apr-2024

Usage document for %sizedir.r

1. Introduction to %sizedir.r
2. sizedir At a Glance
3. Using %sizedir.r
3.1. Running %sizedir.r
4. What you can learn
5. What can break
6. Credits

1. Introduction to %sizedir.r

This script is a handy tool that displays the total size of all %.r files in a directory.

2. sizedir At a Glance

 >> do http://www.rebol.org/cgi-bin/cgiwrap/rebol/download-a-script.r?script-name=sizedir.r
 connecting to: www.rebol.org
 Script: "Total Size of .r Files" (24-Apr-1999)
 58475 bytes
 

3. Using %sizedir.r

There are a few change that be made to this script. You could change the directory that is scanned, and the files that are included in the total.

3.1. Running %sizedir.r

This utility is simple to use. Just DO it.

 >> do %sizedir.r
 

This can be executed directly from the library

 >> do http://www.rebol.org/cgi-bin/cgiwrap/rebol/download-a-script.r?script-name=sizedir.r
 
and will give you information on the %.r files in the current default directory.

4. What you can learn

How REBOL can return a block of filenames by using load on a directory specification. In this example, load %./.

The REBOL size? function returns the length of a file. Note there are complexities to this in real life, as operating system filesystems usually have allocations that don't match actual file sizes. But that is a more advanced topic.

5. What can break

By default, REBOL security settings do not allow directory reads for most directories. Modified versions of %sizedir.r may cause a security question, unless you start up REBOL with the -s option.

6. Credits

%sizedir.r Original author: Unknown