KSH file deletion Shell Script

August 10, 2010 at 19:29:31
Specs: Sun-Solaris
Could anyone help me write a script in KSH that will remove all log files in a particular directory that are older than 3 days? There are a variety of filenames within this particular UNIX directory. I have been told that the actual script should not be that difficult and long to do its function. I thought my shell-scripting was up to the task when I volunteered for the responsibility, but I am insufficient with this request. I am assuming the file deletion needs to be based on the timestamp of the file not the filename itself. Any help would be appreciated.

See More: KSH file deletion Shell Script

Report •

#1
August 11, 2010 at 07:04:57

# UNTESTED
cd <your directory>

find . -type f -mtime +3 -print|xargs rm -f


Report •
Related Solutions


Ask Question