Operating System - Linux
1830733 Members
1804 Online
110015 Solutions
New Discussion

Re: Delete files created before 19:00 hrs CST

 
Manuales
Super Advisor

Delete files created before 19:00 hrs CST

Hi, i need to built a shell wich delete files.
the userid will be located in the path:
/users/user1/

under this path are being created several files each day ..the user id user1 needs to delete files craeted until 19:00 hrs CST

what command can i use to do that?
I think there is acommand to do that, please let me know.

Thanks in advance
Regards.
6 REPLIES 6
Steven Schweda
Honored Contributor

Re: Delete files created before 19:00 hrs CST

For much discussion and many examples, try a
Forum search for keywords like:
find newer touch

Or:
man find
man touch
Manuales
Super Advisor

Re: Delete files created before 19:00 hrs CST

i found this script ...

set `date`
LOG="/home/cadm/shell/log/delete.arch.C1.$2$3.$4.log"
BUSQ="/oracle/C1/saparch"

find $BUSQ -name "C1*.dbf" -mtime +8 -exec ll {} \; >> $LOG
find $BUSQ -name "C1*.dbf" -mtime +8 -exec rm {} \;

could you please let me know the meaning of "+8" ?
how could i runthe command in order to delete files until 19:00 hrs?

thanks in advance.
Steven Schweda
Honored Contributor

Re: Delete files created before 19:00 hrs CST

> i found this script ...

Does it have "newer" in it anywhere? If not,
then keep looking.

> could you please let me know the meaning of
> "+8" ?

Yes. Or, you could read "man find".

> man find

Still a good idea.
Manuales
Super Advisor

Re: Delete files created before 19:00 hrs CST

i do not understand, that is why i am asking !!!
Steven Schweda
Honored Contributor

Re: Delete files created before 19:00 hrs CST

> i do not understand, that is why i am
> asking !!!

What don't you understand? How to do a Forum
search for:
find newer touch
???

Questions just like this have been asked and
answered many times before. The old answers
are just about as good as any new answers
you'll get here.
Dennis Handly
Acclaimed Contributor

Re: Delete files created before 19:00 hrs CST

>could you please let me know the meaning of "+8"?

These aren't the droids you're looking for. :-)
"-mtime +8" says files modified more than 8 days ago.

As Steven said, you should be looking at -newer and a reference file.