LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   -ctime +10 -exec rm {} (https://www.linuxquestions.org/questions/linux-newbie-8/ctime-10-exec-rm-%7B%7D-4175583408/)

Raakh5 06-30-2016 02:03 AM

-ctime +10 -exec rm {}
 
Hello,

Please let me know what is mean by -ctime +10. Is that to remove 10 days old *.dmp file?

Code:

find  /u01/app/oracle/admin/XE/dpdump/dmp -name '*.dmp*' -ctime +10 -exec rm {} \;
Best regards

kaz2100 06-30-2016 02:07 AM

Hya

Your friend
Code:

man find
can help you.

cheers

Raakh5 06-30-2016 02:13 AM

man find is showing
Code:

man find
FIND(1)                                                                FIND(1)

NAME
      find - search for files in a directory hierarchy

SYNOPSIS
      find [-H] [-L] [-P] [-D debugopts] [-Olevel] [path...] [expression]

DESCRIPTION

not able to execute accurate command to use man find what??

Please advise

chrism01 06-30-2016 02:28 AM

This is a little easier to read http://linux.die.net/man/1/find, but 'man find' works as well.
You may not realise that its (man ) being output via a paging system. Try using space-bar or Return key to go through it.

Raakh5 06-30-2016 02:35 AM

Thanks

Code:

-daystart
Measure times (for -amin, -atime, -cmin, -ctime, -mmin, and -mtime) from the beginning of today rather than from 24 hours ago. This option only affects tests which appear later on the command line.

Now it means -ctime is begining of the the day rather then counting time but is that mean 12:00 AM +10 i.e. 22:00? So am i right that the following command will delete *.dmp files that are created at 22:00??

Code:

find  /u01/app/oracle/admin/XE/dpdump/medical -name '*.dmp*' -ctime +10 -exec rm {} \;

Turbocapitalist 06-30-2016 07:31 AM

Quote:

Originally Posted by Raakh5 (Post 5568255)
So am i right that the following command will delete *.dmp files that are created at 22:00??

Code:

find  /u01/app/oracle/admin/XE/dpdump/medical -name '*.dmp*' -ctime +10 -exec rm {} \;

The -ctime +10 means files that are more than 10 days old as of the moment you run "find". If you add -daystart to the mix, you'll find files that are more than 10 days old as of the previous midnight. You might use -mtime instead though, since that will allow you to test files using "touch".

Code:

find  /u01/app/oracle/admin/XE/dpdump/medical -name '*.dmp*' -mtime +10 -exec ls -ldh "{}" \;
find  /u01/app/oracle/admin/XE/dpdump/medical -name '*.dmp*' -daystart -mtime +10 -exec ls -ldh "{}" \;



All times are GMT -5. The time now is 02:17 AM.