![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| delete files older than 5 minutes in directory (recursively) | scarfake | Shell Programming and Scripting | 3 | 06-13-2008 02:10 AM |
| Reg: delete older files from ftp | sam99 | UNIX for Dummies Questions & Answers | 3 | 01-09-2008 10:56 AM |
| delete files and folders older than 3 days | melanie_pfefer | Shell Programming and Scripting | 7 | 12-18-2006 12:58 PM |
| How can I delete files older than 7 days? | odogbolu98 | UNIX for Dummies Questions & Answers | 3 | 02-26-2002 08:35 PM |
| delete files older than 7 days | lesstjm | UNIX for Dummies Questions & Answers | 1 | 11-06-2001 10:43 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
If the OP is on Linux or has GNU find -amin works
Otherwise try: Code:
#!/bin/ksh
# filetimes
filetime()
{
perl -e '
$mtime = (stat $ARGV[0])[9];
print $mtime
' $1
}
now=$(date +%s)
limit=$(( $now - 1800 )) # one half hour ago.
find /path/to/files -type f |\
while read filename
do
dt=$(filetime $filename)
if [[ $dt -lt $limit ]] ; then
rm -f $filename # delete ALL files older then 30 minutes
fi
done
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|