![]() |
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 |
| Command for delete the directories which are older than 7 days | sridhar sivakot | HP-UX | 1 | 02-15-2008 09:11 AM |
| how to archive logs older than 5 days & then delete them? | timus1980 | UNIX for Advanced & Expert Users | 1 | 02-08-2008 06:53 AM |
| Delete user file(s) older then 'X' days ?? | varungupta | UNIX for Advanced & Expert Users | 2 | 08-24-2007 05:01 AM |
| 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 |
|
||||
|
delete file older than N days
Hi, All,
I'd like to delete files older than 1 day. I thought the following command find /your_directory -mtime +1-exec rm -f {} \; will do the work, but not so, it seems like it won't delete files unless it is 2 days old or older. the files between 1 day and 2 days old does not get deleted, so does +1 actually means 2 days? if not so, why it won't delete files between 1 and 2 days old? can someone please help me? |
|
||||
|
delete files older than 1 day
Hi, All,
I'd like to delete files older than 1 day. I thought the following command : find /your_directory -mtime +1-exec rm -f {} \; will do the work, but not so, it seems like it won't delete files unless it is 2 days old or older. the files between 1 day and 2 days old won't get deleted, so does +1 actually means 2 days? if not so, why it won't delete files between 1 and 2 days old? can someone please help me? |
|
|||||
|
Actually, date ranges in the find command do not work quite how you expect them to.
Demonstration at the ksh prompt... Code:
$ for i in 09 10 11 12;do touch -t 200707${i}0000 July_${i};done
$ ls -o
total 0
-rw-r--r-- 1 Ygor 0 Jul 9 00:00 July_09
-rw-r--r-- 1 Ygor 0 Jul 10 00:00 July_10
-rw-r--r-- 1 Ygor 0 Jul 11 00:00 July_11
-rw-r--r-- 1 Ygor 0 Jul 12 00:00 July_12
$ for j in 1 -1 +0 +1;do echo "[[ ${j} ]]";find . -type f -mtime ${j} -print;done
[[ 1 ]]
./July_11
[[ -1 ]]
./July_12
[[ +0 ]]
./July_09
./July_10
./July_11
[[ +1 ]]
./July_09
./July_10
|
|
|||||
|
How to find the Cron entrys path in UNIX server?
Actually, i wanted know about the cron entry path in my UNIX server?
if i issued the crontab -l it will listout the all cront entries in the current server, But i wanted to know about the PATH where all the cron entries is stored? Please, any one help me. Thanks, Siva.P |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| mtime |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|