z/OS UNIX System Services User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Deleting files over a certain age

z/OS UNIX System Services User's Guide
SA23-2279-00

The skulker shell script provides a way to delete files in a directory based on comparing the file's access time to a specified age. This can be useful for removing temporary files created by utilities, or files that were intended to be temporary but were forgotten about.

The skulker script is a z/OS® shell script, and can be easily modified to fit any particular system or user need. The script is located in /samples, but the system administrator should have relocated it somewhere else. Check with the system administrator for the location of the script. You should copy the script into your home directory or subdirectory, where you can modify it if you desire different removal criteria.

It is also possible to invoke the skulker script with the cron daemon so that it may be run on a regular basis.

The format for running the skulker script is as follows:
skulker [-iw] [-r|-R] [-l logfile] directory days_old

The -i option displays the files that are candidates for deletion, and then prompts the user to terminate the script or continue with the deletion.

The -w option does not delete the files, but sends a warning to the owner of each file (via mailx) that the file is a candidate for deletion.

The -r option moves recursively through subdirectories, finding non-directory files that are equal to or older than the specified number of days. The -r option is mutually exclusive with the -R option.

The -R option moves recursively through subdirectories, finding both non-directory files and subdirectories that are equal to or older than the specified number of days. Any subdirectories that are found as candidates for deletion are only deleted if they are empty after all their contents (files, subdirectories and files in subdirectories) that are candidates for deletion have been deleted. The -R option is mutually exclusive with the -r option.

The -l logfile specifies a logfile to store a list of files that have been deleted, are candidates for deletion, or for which warnings have been mailed; and any errors that might have occurred.

directory specifies the directory in which to look for files that are candidates for deletion.

days_old specifies the age of files you want to remove, based on when the file was last accessed.

For more information about the skulker script, including restrictions, see skulker in z/OS UNIX System Services Command Reference.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014