How to delete files older than X hours
up vote
162
down vote
favorite
I'm writing a bash script that needs to delete old files.
It's currently implemented using :
find $LOCATION -name $REQUIRED_FILES -type f -mtime +1 -delete
This will delete of the files older than 1 day.
However, what if I need a finer resolution that 1 day, say like 6 hours old? Is there a nice clean way to do it, like there is using find and -mtime?
bash
add a comment |
up vote
162
down vote
favorite
I'm writing a bash script that needs to delete old files.
It's currently implemented using :
find $LOCATION -name $REQUIRED_FILES -type f -mtime +1 -delete
This will delete of the files older than 1 day.
However, what if I need a finer resolution that 1 day, say like 6 hours old? Is there a nice clean way to do it, like there is using find and -mtime?
bash
add a comment |
up vote
162
down vote
favorite
up vote
162
down vote
favorite
I'm writing a bash script that needs to delete old files.
It's currently implemented using :
find $LOCATION -name $REQUIRED_FILES -type f -mtime +1 -delete
This will delete of the files older than 1 day.
However, what if I need a finer resolution that 1 day, say like 6 hours old? Is there a nice clean way to do it, like there is using find and -mtime?
bash
I'm writing a bash script that needs to delete old files.
It's currently implemented using :
find $LOCATION -name $REQUIRED_FILES -type f -mtime +1 -delete
This will delete of the files older than 1 day.
However, what if I need a finer resolution that 1 day, say like 6 hours old? Is there a nice clean way to do it, like there is using find and -mtime?
bash
bash
asked Oct 30 '08 at 8:31
Tom Feiner
8,111154251
8,111154251
add a comment |
add a comment |
8 Answers
8
active
oldest
votes
up vote
250
down vote
accepted
Does your find
have the -mmin
option? That can let you test the number of mins since last modification:
find $LOCATION -name $REQUIRED_FILES -type f -mmin +360 -delete
Or maybe look at using tmpwatch
to do the same job. phjr also recommended tmpreaper
in the comments.
5
Thanks for the answers everyone, -mmin is exactly what I needed :) somehow I missed it in the man page.
– Tom Feiner
Oct 30 '08 at 8:43
2
Mine doesn't have -mmin :(
– xtofl
Oct 30 '08 at 8:45
2
tmpwatch is for you then!
– Paul Dixon
Oct 30 '08 at 8:48
I find tmpreaper better than tmpwatch - could you also include it in your answer? Thanks.
– Paweł Hajdan
Oct 30 '08 at 12:37
Using --mmin +X returns all files with my find. My fault for not checking this first, but this command just deleted most of my home directory. For me, --mmin -X is the correct argument.
– brandones
Oct 16 '13 at 0:08
|
show 4 more comments
up vote
7
down vote
You could to this trick: create a file 1 hour ago, and use the -newer file
argument.
(Or use touch -t
to create such a file).
2
Yeah, I found this trick in google, however -mmin is much more elegant.
– Tom Feiner
Oct 30 '08 at 8:56
1
there is no -older switch (at least in my find command), and that's what would be needed. -newer doesn't help.
– iconoclast
Feb 17 '11 at 6:53
5
@Brandon: luckily, there is the!
operator...
– xtofl
Feb 17 '11 at 8:39
can you give a touch command that would generate a file 1 hour old that will work on machines that can't use -mmin? (If you're on Linux, -mmin is available, if not then date and other commands are also feeble in comparison.)
– iconoclast
May 10 '11 at 17:20
1
@iconoclasttouch -t $(date -d '-1 hour' +%Y%m%d%H%M.00) test
Creates filetest
that's always 1 hour old.
– rovr138
Jan 20 at 15:29
add a comment |
up vote
2
down vote
Here is the approach that worked for me (and I don't see it being used above)
$ find /path/to/the/folder -name *.* -mmin +59 -delete > /dev/null
deleting all the files older than 59 minutes while leaving the folders intact.
add a comment |
up vote
1
down vote
For SunOS 5.10
Example 6 Selecting a File Using 24-hour Mode
The descriptions of -atime, -ctime, and -mtime use the ter-
minology n ``24-hour periods''. For example, a file accessed
at 23:59 is selected by:
example% find . -atime -1 -print
at 00:01 the next day (less than 24 hours later, not more
than one day ago). The midnight boundary between days has no
effect on the 24-hour calculation.
add a comment |
up vote
0
down vote
-mmin is for minutes.
Try looking at the man page.
man find
for more types.
add a comment |
up vote
0
down vote
If you do not have "-mmin" in your version of "find", then "-mtime -0.041667" gets pretty close to "within the last hour", so in your case, use:
-mtime +(X * 0.041667)
so, if X means 6 hours, then:
find . -mtime +0.25 -ls
works because 24 hours * 0.25 = 6 hours
add a comment |
up vote
0
down vote
Here is what one can do for going on the way @iconoclast was wondering about in their comment on another answer.
use crontab for user or an /etc/crontab
to create file /tmp/hour
:
# m h dom mon dow user command
0 * * * * root /usr/bin/touch /tmp/hour > /dev/null 2>&1
and then use this to run your command:
find /tmp/ -daystart -maxdepth 1 -not -newer /tmp/hour -type f -name "for_one_hour_files*" -exec do_something {} ;
No problem. @ericaya actually did most of it, I just touched things up.
– Paul Roub
Jun 13 '17 at 13:34
*/1
for hourly is redundant in your crontab. It's the same as putting * in the hour field.
– colminator
Jun 20 '17 at 18:10
@columnator -you are right, I've corrected my entry.
– satyr0909
Jul 11 '17 at 14:17
add a comment |
up vote
0
down vote
find $PATH -name $log_prefix"*"$log_ext -mmin +$num_mins -exec rm -f {} ;
add a comment |
8 Answers
8
active
oldest
votes
8 Answers
8
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
250
down vote
accepted
Does your find
have the -mmin
option? That can let you test the number of mins since last modification:
find $LOCATION -name $REQUIRED_FILES -type f -mmin +360 -delete
Or maybe look at using tmpwatch
to do the same job. phjr also recommended tmpreaper
in the comments.
5
Thanks for the answers everyone, -mmin is exactly what I needed :) somehow I missed it in the man page.
– Tom Feiner
Oct 30 '08 at 8:43
2
Mine doesn't have -mmin :(
– xtofl
Oct 30 '08 at 8:45
2
tmpwatch is for you then!
– Paul Dixon
Oct 30 '08 at 8:48
I find tmpreaper better than tmpwatch - could you also include it in your answer? Thanks.
– Paweł Hajdan
Oct 30 '08 at 12:37
Using --mmin +X returns all files with my find. My fault for not checking this first, but this command just deleted most of my home directory. For me, --mmin -X is the correct argument.
– brandones
Oct 16 '13 at 0:08
|
show 4 more comments
up vote
250
down vote
accepted
Does your find
have the -mmin
option? That can let you test the number of mins since last modification:
find $LOCATION -name $REQUIRED_FILES -type f -mmin +360 -delete
Or maybe look at using tmpwatch
to do the same job. phjr also recommended tmpreaper
in the comments.
5
Thanks for the answers everyone, -mmin is exactly what I needed :) somehow I missed it in the man page.
– Tom Feiner
Oct 30 '08 at 8:43
2
Mine doesn't have -mmin :(
– xtofl
Oct 30 '08 at 8:45
2
tmpwatch is for you then!
– Paul Dixon
Oct 30 '08 at 8:48
I find tmpreaper better than tmpwatch - could you also include it in your answer? Thanks.
– Paweł Hajdan
Oct 30 '08 at 12:37
Using --mmin +X returns all files with my find. My fault for not checking this first, but this command just deleted most of my home directory. For me, --mmin -X is the correct argument.
– brandones
Oct 16 '13 at 0:08
|
show 4 more comments
up vote
250
down vote
accepted
up vote
250
down vote
accepted
Does your find
have the -mmin
option? That can let you test the number of mins since last modification:
find $LOCATION -name $REQUIRED_FILES -type f -mmin +360 -delete
Or maybe look at using tmpwatch
to do the same job. phjr also recommended tmpreaper
in the comments.
Does your find
have the -mmin
option? That can let you test the number of mins since last modification:
find $LOCATION -name $REQUIRED_FILES -type f -mmin +360 -delete
Or maybe look at using tmpwatch
to do the same job. phjr also recommended tmpreaper
in the comments.
edited Nov 11 at 8:09
Bitcoin Murderous Maniac
4831616
4831616
answered Oct 30 '08 at 8:39
Paul Dixon
238k40281316
238k40281316
5
Thanks for the answers everyone, -mmin is exactly what I needed :) somehow I missed it in the man page.
– Tom Feiner
Oct 30 '08 at 8:43
2
Mine doesn't have -mmin :(
– xtofl
Oct 30 '08 at 8:45
2
tmpwatch is for you then!
– Paul Dixon
Oct 30 '08 at 8:48
I find tmpreaper better than tmpwatch - could you also include it in your answer? Thanks.
– Paweł Hajdan
Oct 30 '08 at 12:37
Using --mmin +X returns all files with my find. My fault for not checking this first, but this command just deleted most of my home directory. For me, --mmin -X is the correct argument.
– brandones
Oct 16 '13 at 0:08
|
show 4 more comments
5
Thanks for the answers everyone, -mmin is exactly what I needed :) somehow I missed it in the man page.
– Tom Feiner
Oct 30 '08 at 8:43
2
Mine doesn't have -mmin :(
– xtofl
Oct 30 '08 at 8:45
2
tmpwatch is for you then!
– Paul Dixon
Oct 30 '08 at 8:48
I find tmpreaper better than tmpwatch - could you also include it in your answer? Thanks.
– Paweł Hajdan
Oct 30 '08 at 12:37
Using --mmin +X returns all files with my find. My fault for not checking this first, but this command just deleted most of my home directory. For me, --mmin -X is the correct argument.
– brandones
Oct 16 '13 at 0:08
5
5
Thanks for the answers everyone, -mmin is exactly what I needed :) somehow I missed it in the man page.
– Tom Feiner
Oct 30 '08 at 8:43
Thanks for the answers everyone, -mmin is exactly what I needed :) somehow I missed it in the man page.
– Tom Feiner
Oct 30 '08 at 8:43
2
2
Mine doesn't have -mmin :(
– xtofl
Oct 30 '08 at 8:45
Mine doesn't have -mmin :(
– xtofl
Oct 30 '08 at 8:45
2
2
tmpwatch is for you then!
– Paul Dixon
Oct 30 '08 at 8:48
tmpwatch is for you then!
– Paul Dixon
Oct 30 '08 at 8:48
I find tmpreaper better than tmpwatch - could you also include it in your answer? Thanks.
– Paweł Hajdan
Oct 30 '08 at 12:37
I find tmpreaper better than tmpwatch - could you also include it in your answer? Thanks.
– Paweł Hajdan
Oct 30 '08 at 12:37
Using --mmin +X returns all files with my find. My fault for not checking this first, but this command just deleted most of my home directory. For me, --mmin -X is the correct argument.
– brandones
Oct 16 '13 at 0:08
Using --mmin +X returns all files with my find. My fault for not checking this first, but this command just deleted most of my home directory. For me, --mmin -X is the correct argument.
– brandones
Oct 16 '13 at 0:08
|
show 4 more comments
up vote
7
down vote
You could to this trick: create a file 1 hour ago, and use the -newer file
argument.
(Or use touch -t
to create such a file).
2
Yeah, I found this trick in google, however -mmin is much more elegant.
– Tom Feiner
Oct 30 '08 at 8:56
1
there is no -older switch (at least in my find command), and that's what would be needed. -newer doesn't help.
– iconoclast
Feb 17 '11 at 6:53
5
@Brandon: luckily, there is the!
operator...
– xtofl
Feb 17 '11 at 8:39
can you give a touch command that would generate a file 1 hour old that will work on machines that can't use -mmin? (If you're on Linux, -mmin is available, if not then date and other commands are also feeble in comparison.)
– iconoclast
May 10 '11 at 17:20
1
@iconoclasttouch -t $(date -d '-1 hour' +%Y%m%d%H%M.00) test
Creates filetest
that's always 1 hour old.
– rovr138
Jan 20 at 15:29
add a comment |
up vote
7
down vote
You could to this trick: create a file 1 hour ago, and use the -newer file
argument.
(Or use touch -t
to create such a file).
2
Yeah, I found this trick in google, however -mmin is much more elegant.
– Tom Feiner
Oct 30 '08 at 8:56
1
there is no -older switch (at least in my find command), and that's what would be needed. -newer doesn't help.
– iconoclast
Feb 17 '11 at 6:53
5
@Brandon: luckily, there is the!
operator...
– xtofl
Feb 17 '11 at 8:39
can you give a touch command that would generate a file 1 hour old that will work on machines that can't use -mmin? (If you're on Linux, -mmin is available, if not then date and other commands are also feeble in comparison.)
– iconoclast
May 10 '11 at 17:20
1
@iconoclasttouch -t $(date -d '-1 hour' +%Y%m%d%H%M.00) test
Creates filetest
that's always 1 hour old.
– rovr138
Jan 20 at 15:29
add a comment |
up vote
7
down vote
up vote
7
down vote
You could to this trick: create a file 1 hour ago, and use the -newer file
argument.
(Or use touch -t
to create such a file).
You could to this trick: create a file 1 hour ago, and use the -newer file
argument.
(Or use touch -t
to create such a file).
answered Oct 30 '08 at 8:51
xtofl
31.5k678160
31.5k678160
2
Yeah, I found this trick in google, however -mmin is much more elegant.
– Tom Feiner
Oct 30 '08 at 8:56
1
there is no -older switch (at least in my find command), and that's what would be needed. -newer doesn't help.
– iconoclast
Feb 17 '11 at 6:53
5
@Brandon: luckily, there is the!
operator...
– xtofl
Feb 17 '11 at 8:39
can you give a touch command that would generate a file 1 hour old that will work on machines that can't use -mmin? (If you're on Linux, -mmin is available, if not then date and other commands are also feeble in comparison.)
– iconoclast
May 10 '11 at 17:20
1
@iconoclasttouch -t $(date -d '-1 hour' +%Y%m%d%H%M.00) test
Creates filetest
that's always 1 hour old.
– rovr138
Jan 20 at 15:29
add a comment |
2
Yeah, I found this trick in google, however -mmin is much more elegant.
– Tom Feiner
Oct 30 '08 at 8:56
1
there is no -older switch (at least in my find command), and that's what would be needed. -newer doesn't help.
– iconoclast
Feb 17 '11 at 6:53
5
@Brandon: luckily, there is the!
operator...
– xtofl
Feb 17 '11 at 8:39
can you give a touch command that would generate a file 1 hour old that will work on machines that can't use -mmin? (If you're on Linux, -mmin is available, if not then date and other commands are also feeble in comparison.)
– iconoclast
May 10 '11 at 17:20
1
@iconoclasttouch -t $(date -d '-1 hour' +%Y%m%d%H%M.00) test
Creates filetest
that's always 1 hour old.
– rovr138
Jan 20 at 15:29
2
2
Yeah, I found this trick in google, however -mmin is much more elegant.
– Tom Feiner
Oct 30 '08 at 8:56
Yeah, I found this trick in google, however -mmin is much more elegant.
– Tom Feiner
Oct 30 '08 at 8:56
1
1
there is no -older switch (at least in my find command), and that's what would be needed. -newer doesn't help.
– iconoclast
Feb 17 '11 at 6:53
there is no -older switch (at least in my find command), and that's what would be needed. -newer doesn't help.
– iconoclast
Feb 17 '11 at 6:53
5
5
@Brandon: luckily, there is the
!
operator...– xtofl
Feb 17 '11 at 8:39
@Brandon: luckily, there is the
!
operator...– xtofl
Feb 17 '11 at 8:39
can you give a touch command that would generate a file 1 hour old that will work on machines that can't use -mmin? (If you're on Linux, -mmin is available, if not then date and other commands are also feeble in comparison.)
– iconoclast
May 10 '11 at 17:20
can you give a touch command that would generate a file 1 hour old that will work on machines that can't use -mmin? (If you're on Linux, -mmin is available, if not then date and other commands are also feeble in comparison.)
– iconoclast
May 10 '11 at 17:20
1
1
@iconoclast
touch -t $(date -d '-1 hour' +%Y%m%d%H%M.00) test
Creates file test
that's always 1 hour old.– rovr138
Jan 20 at 15:29
@iconoclast
touch -t $(date -d '-1 hour' +%Y%m%d%H%M.00) test
Creates file test
that's always 1 hour old.– rovr138
Jan 20 at 15:29
add a comment |
up vote
2
down vote
Here is the approach that worked for me (and I don't see it being used above)
$ find /path/to/the/folder -name *.* -mmin +59 -delete > /dev/null
deleting all the files older than 59 minutes while leaving the folders intact.
add a comment |
up vote
2
down vote
Here is the approach that worked for me (and I don't see it being used above)
$ find /path/to/the/folder -name *.* -mmin +59 -delete > /dev/null
deleting all the files older than 59 minutes while leaving the folders intact.
add a comment |
up vote
2
down vote
up vote
2
down vote
Here is the approach that worked for me (and I don't see it being used above)
$ find /path/to/the/folder -name *.* -mmin +59 -delete > /dev/null
deleting all the files older than 59 minutes while leaving the folders intact.
Here is the approach that worked for me (and I don't see it being used above)
$ find /path/to/the/folder -name *.* -mmin +59 -delete > /dev/null
deleting all the files older than 59 minutes while leaving the folders intact.
edited Feb 20 at 14:36
iBug
16.5k53359
16.5k53359
answered Feb 20 at 14:36
Axel Ronsin
212
212
add a comment |
add a comment |
up vote
1
down vote
For SunOS 5.10
Example 6 Selecting a File Using 24-hour Mode
The descriptions of -atime, -ctime, and -mtime use the ter-
minology n ``24-hour periods''. For example, a file accessed
at 23:59 is selected by:
example% find . -atime -1 -print
at 00:01 the next day (less than 24 hours later, not more
than one day ago). The midnight boundary between days has no
effect on the 24-hour calculation.
add a comment |
up vote
1
down vote
For SunOS 5.10
Example 6 Selecting a File Using 24-hour Mode
The descriptions of -atime, -ctime, and -mtime use the ter-
minology n ``24-hour periods''. For example, a file accessed
at 23:59 is selected by:
example% find . -atime -1 -print
at 00:01 the next day (less than 24 hours later, not more
than one day ago). The midnight boundary between days has no
effect on the 24-hour calculation.
add a comment |
up vote
1
down vote
up vote
1
down vote
For SunOS 5.10
Example 6 Selecting a File Using 24-hour Mode
The descriptions of -atime, -ctime, and -mtime use the ter-
minology n ``24-hour periods''. For example, a file accessed
at 23:59 is selected by:
example% find . -atime -1 -print
at 00:01 the next day (less than 24 hours later, not more
than one day ago). The midnight boundary between days has no
effect on the 24-hour calculation.
For SunOS 5.10
Example 6 Selecting a File Using 24-hour Mode
The descriptions of -atime, -ctime, and -mtime use the ter-
minology n ``24-hour periods''. For example, a file accessed
at 23:59 is selected by:
example% find . -atime -1 -print
at 00:01 the next day (less than 24 hours later, not more
than one day ago). The midnight boundary between days has no
effect on the 24-hour calculation.
edited May 4 '12 at 14:41
Darren
52.9k1599113
52.9k1599113
answered Jun 2 '10 at 11:37
Rajeev Rumale
111
111
add a comment |
add a comment |
up vote
0
down vote
-mmin is for minutes.
Try looking at the man page.
man find
for more types.
add a comment |
up vote
0
down vote
-mmin is for minutes.
Try looking at the man page.
man find
for more types.
add a comment |
up vote
0
down vote
up vote
0
down vote
-mmin is for minutes.
Try looking at the man page.
man find
for more types.
-mmin is for minutes.
Try looking at the man page.
man find
for more types.
answered Oct 30 '08 at 8:37
GavinCattell
3,3531520
3,3531520
add a comment |
add a comment |
up vote
0
down vote
If you do not have "-mmin" in your version of "find", then "-mtime -0.041667" gets pretty close to "within the last hour", so in your case, use:
-mtime +(X * 0.041667)
so, if X means 6 hours, then:
find . -mtime +0.25 -ls
works because 24 hours * 0.25 = 6 hours
add a comment |
up vote
0
down vote
If you do not have "-mmin" in your version of "find", then "-mtime -0.041667" gets pretty close to "within the last hour", so in your case, use:
-mtime +(X * 0.041667)
so, if X means 6 hours, then:
find . -mtime +0.25 -ls
works because 24 hours * 0.25 = 6 hours
add a comment |
up vote
0
down vote
up vote
0
down vote
If you do not have "-mmin" in your version of "find", then "-mtime -0.041667" gets pretty close to "within the last hour", so in your case, use:
-mtime +(X * 0.041667)
so, if X means 6 hours, then:
find . -mtime +0.25 -ls
works because 24 hours * 0.25 = 6 hours
If you do not have "-mmin" in your version of "find", then "-mtime -0.041667" gets pretty close to "within the last hour", so in your case, use:
-mtime +(X * 0.041667)
so, if X means 6 hours, then:
find . -mtime +0.25 -ls
works because 24 hours * 0.25 = 6 hours
answered Jun 30 '17 at 2:25
Malcolm Boekhoff
65696
65696
add a comment |
add a comment |
up vote
0
down vote
Here is what one can do for going on the way @iconoclast was wondering about in their comment on another answer.
use crontab for user or an /etc/crontab
to create file /tmp/hour
:
# m h dom mon dow user command
0 * * * * root /usr/bin/touch /tmp/hour > /dev/null 2>&1
and then use this to run your command:
find /tmp/ -daystart -maxdepth 1 -not -newer /tmp/hour -type f -name "for_one_hour_files*" -exec do_something {} ;
No problem. @ericaya actually did most of it, I just touched things up.
– Paul Roub
Jun 13 '17 at 13:34
*/1
for hourly is redundant in your crontab. It's the same as putting * in the hour field.
– colminator
Jun 20 '17 at 18:10
@columnator -you are right, I've corrected my entry.
– satyr0909
Jul 11 '17 at 14:17
add a comment |
up vote
0
down vote
Here is what one can do for going on the way @iconoclast was wondering about in their comment on another answer.
use crontab for user or an /etc/crontab
to create file /tmp/hour
:
# m h dom mon dow user command
0 * * * * root /usr/bin/touch /tmp/hour > /dev/null 2>&1
and then use this to run your command:
find /tmp/ -daystart -maxdepth 1 -not -newer /tmp/hour -type f -name "for_one_hour_files*" -exec do_something {} ;
No problem. @ericaya actually did most of it, I just touched things up.
– Paul Roub
Jun 13 '17 at 13:34
*/1
for hourly is redundant in your crontab. It's the same as putting * in the hour field.
– colminator
Jun 20 '17 at 18:10
@columnator -you are right, I've corrected my entry.
– satyr0909
Jul 11 '17 at 14:17
add a comment |
up vote
0
down vote
up vote
0
down vote
Here is what one can do for going on the way @iconoclast was wondering about in their comment on another answer.
use crontab for user or an /etc/crontab
to create file /tmp/hour
:
# m h dom mon dow user command
0 * * * * root /usr/bin/touch /tmp/hour > /dev/null 2>&1
and then use this to run your command:
find /tmp/ -daystart -maxdepth 1 -not -newer /tmp/hour -type f -name "for_one_hour_files*" -exec do_something {} ;
Here is what one can do for going on the way @iconoclast was wondering about in their comment on another answer.
use crontab for user or an /etc/crontab
to create file /tmp/hour
:
# m h dom mon dow user command
0 * * * * root /usr/bin/touch /tmp/hour > /dev/null 2>&1
and then use this to run your command:
find /tmp/ -daystart -maxdepth 1 -not -newer /tmp/hour -type f -name "for_one_hour_files*" -exec do_something {} ;
edited Jul 11 '17 at 14:15
answered Jun 13 '17 at 13:10
satyr0909
112
112
No problem. @ericaya actually did most of it, I just touched things up.
– Paul Roub
Jun 13 '17 at 13:34
*/1
for hourly is redundant in your crontab. It's the same as putting * in the hour field.
– colminator
Jun 20 '17 at 18:10
@columnator -you are right, I've corrected my entry.
– satyr0909
Jul 11 '17 at 14:17
add a comment |
No problem. @ericaya actually did most of it, I just touched things up.
– Paul Roub
Jun 13 '17 at 13:34
*/1
for hourly is redundant in your crontab. It's the same as putting * in the hour field.
– colminator
Jun 20 '17 at 18:10
@columnator -you are right, I've corrected my entry.
– satyr0909
Jul 11 '17 at 14:17
No problem. @ericaya actually did most of it, I just touched things up.
– Paul Roub
Jun 13 '17 at 13:34
No problem. @ericaya actually did most of it, I just touched things up.
– Paul Roub
Jun 13 '17 at 13:34
*/1
for hourly is redundant in your crontab. It's the same as putting * in the hour field.– colminator
Jun 20 '17 at 18:10
*/1
for hourly is redundant in your crontab. It's the same as putting * in the hour field.– colminator
Jun 20 '17 at 18:10
@columnator -you are right, I've corrected my entry.
– satyr0909
Jul 11 '17 at 14:17
@columnator -you are right, I've corrected my entry.
– satyr0909
Jul 11 '17 at 14:17
add a comment |
up vote
0
down vote
find $PATH -name $log_prefix"*"$log_ext -mmin +$num_mins -exec rm -f {} ;
add a comment |
up vote
0
down vote
find $PATH -name $log_prefix"*"$log_ext -mmin +$num_mins -exec rm -f {} ;
add a comment |
up vote
0
down vote
up vote
0
down vote
find $PATH -name $log_prefix"*"$log_ext -mmin +$num_mins -exec rm -f {} ;
find $PATH -name $log_prefix"*"$log_ext -mmin +$num_mins -exec rm -f {} ;
edited Jan 13 at 18:57
shukshin.ivan
7,82522856
7,82522856
answered Oct 31 '16 at 22:32
Eragonz91
127112
127112
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f249578%2fhow-to-delete-files-older-than-x-hours%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown