cmd a ) find . -mtime 0
generates different results compared to
cmd b) find . -mtime 0 -exec ls -l {} \;
The number of rows resulted and their contents are entirely different
The cmd a generates all files within last 24 hours
.
./rman10g_RMAN10G_93_1_703173487.gz
./abc.gz
./initrman10g.ora
./rman10g_RMAN10G_94_1_703173514.gz
./rman10g_RMAN10G_95_1_703173539.gz
./rman10g_c-2297353754-20091117-00.gz
./al_RMAN10G_101_1_703259946.gz
./rman10g_RMAN10G_100_1_703259937.gz
./rman10g_c-2297353754-20091116-00.gz
but cmd b generates
-rw-r--r-- 1 oracle dba 24 2009-11-18 13:52 abc.gz
-rw-r----- 1 oracle dba 42842978 2009-11-18 13:59
al_RMAN10G_101_1_703259946.gz
-rw-r----- 1 oracle dba 59552802 2009-11-16 13:59
al_RMAN10G_90_1_703087153.gz
-rw-r----- 1 oracle dba 42856082 2009-11-16 13:59
al_RMAN10G_91_1_703087180.gz
-rw-r----- 1 oracle dba 45935755 2009-11-17 13:59
al_RMAN10G_96_1_703173548.gz
-rw-r--r-- 1 oracle dba 1133 2009-11-18 13:59 initrman10g.ora
-rw-r----- 1 oracle dba 36794 2009-11-17 16:40
rman10g_c-2297353754-20091116-00.gz
-rw-r----- 1 oracle dba 37808 2009-11-17 16:40
rman10g_c-2297353754-20091117-00.gz
-rw-r----- 1 oracle dba 14501537 2009-11-18 13:58
rman10g_RMAN10G_100_1_703259937.gz
-rw-r----- 1 oracle dba 102006757 2009-11-16 13:58
rman10g_RMAN10G_87_1_703087088.gz
-rw-r----- 1 oracle dba 41019242 2009-11-18 15:53
rman10g_RMAN10G_88_1_703087123.gz
-rw-r----- 1 oracle dba 14501535 2009-11-17 15:48
rman10g_RMAN10G_89_1_703087139.gz
-rw-r----- 1 oracle dba 102374343 2009-11-17 16:22
rman10g_RMAN10G_93_1_703173487.gz
-rw-r----- 1 oracle dba 41330147 2009-11-17 16:36
rman10g_RMAN10G_94_1_703173514.gz
-rw-r----- 1 oracle dba 14501776 2009-11-17 16:40
rman10g_RMAN10G_95_1_703173539.gz
-rw-r----- 1 oracle dba 606 2009-11-17 13:58
spfilerman10g.ora.gz
-rw-r----- 1 oracle dba 102374343 2009-11-17 16:22 ./
rman10g_RMAN10G_93_1_703173487.gz
-rw-r--r-- 1 oracle dba 24 2009-11-18 13:52 ./abc.gz
-rw-r--r-- 1 oracle dba 1133 2009-11-18 13:59 ./initrman10g.ora
-rw-r----- 1 oracle dba 41330147 2009-11-17 16:36 ./
rman10g_RMAN10G_94_1_703173514.gz
-rw-r----- 1 oracle dba 14501776 2009-11-17 16:40 ./
rman10g_RMAN10G_95_1_703173539.gz
-rw-r----- 1 oracle dba 37808 2009-11-17 16:40 ./
rman10g_c-2297353754-20091117-00.gz
-rw-r----- 1 oracle dba 42842978 2009-11-18 13:59 ./
al_RMAN10G_101_1_703259946.gz
-rw-r----- 1 oracle dba 14501537 2009-11-18 13:58 ./
rman10g_RMAN10G_100_1_703259937.gz
-rw-r----- 1 oracle dba 41019242 2009-11-18 15:53 ./
rman10g_RMAN10G_88_1_703087123.gz
-rw-r----- 1 oracle dba 36794 2009-11-17 16:40 ./
rman10g_c-2297353754-20091116-00.gz
Any clues ???
Try adding '-type f'. The ls -l is acting on the current directory.
That's what I reckon anyway.
--
S. Anthony Sequeira
++
* dark greets liw with a small yellow frog.
* liw kisses the frog and watches it transform to a beautiful nerd
girl, takes her out to ice cream, and lives happily forever after
with her
<dark> liw: Umm it's too late to have the frog back?
++
The output of the the "find" command includes both files and
directories. When you invoke "ls -l" with a directory name, it lists
the contents of the directory, not just the directory itself.
Try using "ls -ld" rather than "ls -l", or use "find ... -ls" if you
don't mind a somewhat different output format.
--
Keith Thompson (The_Other_Keith) ks...@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
a) find . -mtime 0
If The results of the above command 'a' generates 5 rows
why is the result of the command
b) find . -mtime 0 - exec ls -l {} \;
generating more than 5 rows
c) find . -mtime 0 -exec rm {} \;
I expect the result of the command 'c' will delete only the rows found
by the first part of the command
find . -mtime 0
Any clues ????
On Nov 18, 5:21 pm, Keith Thompson <ks...@mib.org> wrote:
Did you consider Kieth's and Tony's comments?
Or try their suggestions?
Let me ask you, both ./etc and ./etc/passwd are possible outputs
from your command if run from the root directory. Each are just
one "row" of the output from command a). Yet "ls -l ./etc/passwd"
(command b) only generates one row of output while "ls -l ./etc"
generates about 300. Why is this??
BECAUSE /etc IS A DIRECTORY!
Go back and consider the already provided answers.
Thanks to all your responses.....
I have now understood the issue
And I am totally clear......
Sorry guys, for being so dense.....I guess I have been working a lot
lately and not watching TV -
I guess I need some TV time too....This helps you know.
No, I am not joking....
When they built the pyramids - the suggestion to increase output was
let the workers who were working 7 days a week get a day off....It
sounded crazy but yes - The output increased when the workers got one
day off....
Because "ls -l ." generates more than one row.
-s
--
Copyright 2009, all wrongs reversed. Peter Seebach / usenet...@seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!