Assignment #1

Due Midnight, Wednesday Sept. 18, 1996

Implement the following utility using either the Bourne "sh" or Berkeley "csh"

NAME

freespace - to free disk space in a directory

SYNOPSIS

freespace [directory]

DESCRIPTION

If no directory is given assume the current working directory.

The program reads the contents of the shell (environment) variable "cleanup" ("CLEANUP") to find out which files to be removed.

Example:
setenv CLEANUP core:a.out:*.o:*.aux:*.log
or
set cleanup=(core a.out *.o *.aux *.log)

The program displays the content of this variable before proceeding.

Example:
Removing core:a.out:*.o:*.aux:*.log? (Y/N)
or
Removing core a.out *.o *.aux *.log ? (Y/N)

If the variable is not defined, the program prompts the user with the following message:

No files are specified, Removing core? (Y/N)


The program creates a file called "freespace.output" in your home directory to report the the amount of storage it has freed. Each entry in this file have the following format:
date (directory) storage-before -> storage-after

Example:
Mon Sep 2 23:49:25 EDT 1996 (/home/wahab/CS476) 185284 -> 172386
Mon Sep 2 23:49:25 EDT 1996 (/home/wahab/CS476/cs476.96Fall) 118 -> 110


SEE ALSO

find, date, du, rm


Back to Assignments Page
Back to CS476/576 Home Page