on 07-25-2010 5:08 PM
HI ,
Can anyone help me with creating a script for deleting old files and folders like core etc........form OS level automatically on solaris platform.
i am looking for a script for deleting old files form a particular folder like work etc .
Dev
Got the script
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
This sample script will help.
#!/bin/ksh
tdir=<Set the directory frokm which you want to delete the files"
find $tdir/ -mtime +<How many Hours OLD file> -exec rm -f {} \;
Create a script with above code and schedule it in crontab.
Eg:
I want to delete 30 days old files from work directory, i'll use script something like below.
#!/bin/ksh
tdir=/usr/sap/SID/DEVMGS**/work
find $tdir/ -mtime +720 -exec rm -f {} \;
Similar way setup for the cron ..!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.