![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| AWK help please - beginner | COLLEGE | UNIX for Dummies Questions & Answers | 4 | 06-13-2007 08:40 AM |
| Beginner C | frustrated1 | High Level Programming | 2 | 05-21-2007 03:14 PM |
| Please help. I am a beginner. | Lykathea Aflame | Shell Programming and Scripting | 1 | 04-26-2006 02:46 AM |
| Shell Script for Beginner | aaron_fong | Shell Programming and Scripting | 3 | 07-18-2005 03:24 AM |
| Beginner trying to write a shell script! | duncan_glover | Shell Programming and Scripting | 3 | 08-19-2002 11:58 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Beginner needs help with script
I would like to get a sample script (ksh or bash, or both so I could see the differences)
What I want to do with the script is send an daily email to myself that contains the following:
I also want to delete files greater that n days old in a directory |
|
||||
|
Here is a start.. You need to use find. Code:
# find files older than 10 days and delete them
find /path/to/directory -type f -mtime +10 -exec rm -f {} \;
# count files
echo "file count \c"
find /path/to/directory -type f -print | wc -l
See Perderabo's datecalc script in the FAQ on date arithmetic to get yesterday, tomorrow, etc. Then build a filename, use cat to display the file |
|
||||
|
Thanks Jim,
I got the code for datecalc, it requires the following format The code I am using to get yesterdays date is; curr_time=`date +"%Y-%m-%d"` yesterday=`./datecalc.ksh -a $curr_time -1` Also how would I send all of that stuff in an email? Last edited by martyb555; 02-16-2008 at 03:59 PM.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|