Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I would like to delete some old redolog file in oracle directory and try this command:
Code:
find /oracle/IDS/oraarch -ctime +1 -print
Just to see a list (print, which I want to replace with delete)
I tried as well mtime and atime.
Unfortunately I get listed only 3 files (first 3 files), but the list should be much longer. I though maybe system time is wrong, but command 'date' gives me correct time. When I execute 'ls -la' I see whole list of files with dates.
I also tried to use 'stat <FILE>' to check some single files.
When I use:
Code:
find /oracle/IDS/oraarch -ctime 1 -print
the list is longer, but in this case I do not see older files
has anybody explanation for this strange behavior?
regards
Rafal
Last edited by RAFAL; 03-26-2010 at 06:01 AM.
Reason: added one comment
The time options of find are atime, ctime and mtime. These refer to, in order, the time the file was last accessed, the time the file's status was last changed, and the time the files data was last modified.
The option that most closely relates to the output of ls is mtime, so change your find statement to use that instead of ctime.
The time options of find are atime, ctime and mtime. These refer to, in order, the time the file was last accessed, the time the file's status was last changed, and the time the files data was last modified.
The option that most closely relates to the output of ls is mtime, so change your find statement to use that instead of ctime.
hi
Thanks for the answer, but as I said "I tried as well mtime and atime."
its all the same, to I really do not know what is the issue here. Apparently something with "+" sign and the way how its interpreted
Sorry for not reading properly. The difference between 1 and +1 is "exactly 1" compared to "more than 1" days ago. If you specify the "+" in your find, then it means "more than that many days" ago. If you leave it out, it means "exactly that many days ago".
An example from my server, using 32 instead of 1:-
Code:
[root@eddie WORK]# find . -mtime 32 -exec ls -ld {} \;
drwxrwsr-x 2 mhb crms 4096 Feb 25 17:43 ./at10528WRK
drwxrwsr-x 2 mhb crms 4096 Feb 25 17:45 ./at10735WRK
drwxrwsr-x 2 mhb crms 4096 Feb 25 17:43 ./at10573WRK
drwxrwsrwx 2 irb crms 4096 Feb 25 15:18 ./at1284WRK
drwxrwsr-x 2 mhb crms 4096 Feb 25 12:12 ./at21545WRK
drwxrwsrwx 2 irb crms 4096 Feb 25 15:20 ./at1902WRK
drwxrwsrwx 2 irb crms 4096 Feb 25 15:20 ./at1743WRK
drwxrwsrwx 2 irb crms 4096 Feb 25 15:20 ./at1856WRK
drwxrwsr-x 2 mhb crms 4096 Feb 25 17:30 ./at21605WRK
[root@eddie WORK]# find . -mtime +32 -exec ls -ld {} \;|grep "Feb 25"
[root@eddie WORK]#
Using "32" returns entries that are that many days old exactly, but using "+32" (and grepping only for Feb 25 to exclude all the other files it would return) doesn't return the same entries from Feb 25.
Plus, I still think you should use mtime instead of ctime
Last edited by blacky_5251; 03-29-2010 at 05:59 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.