Find command confusion
Hi folks,
what is the diffrent between below two commands. Code:
#find /home/*/mail/ -type f -mtime +547 -exec du -ch {} + But, if i execute the below command, i get 1.1G total Code:
#find -P /home/*/mail/ -mindepth 1 -maxdepth 1 -mtime '+547' -exec du -ch {} + |
the first thing I would try is just echo /home/*/mail/ to see what is that exactly. Next, you can try strace the find command to see how is it working.
|
Quote:
here is a sample out oput for echo. Quote:
/home/imssafe/mail/ /home/lbilad1/mail/ /home/lhamidh/mail/ /home/lhudalk/mail/ /home/lwasath/mail/ /home/namdesi/mail/ /home/onelk/mail/ /home/iyawan/mail/ |
actually this is the exim mail server folder in a web server.
|
that won't help me to solve it but you can now check strace find to see what's happening.
|
Thanks buddy for the introduction of strace command. ill have a look.
|
Quote:
I would start with a simple Code:
#find /home/*/mail/ -type f -mtime +547 -exec /bin/echo {} + >/tmp/findout1 |
Quote:
findout1 sample Quote:
Quote:
|
Quote:
And if there is no difference, I will be even more puzzled :) |
From the current output I would think the answer is already obvious, the one with a min/max depth stops at the first level after /home/*/mail and then you get a total of that, whereas the other find
works its way down to a single file level and provides the information back, some of these files may never be found if first level after mail does not hold true to the mtime used in first example. Of course, I could be wrong, but that is what I see :) |
What's strange though is the fact that the find that stops at the first level yields 1.1GB, whereas the unlimited find only comes up with 200MB. Had it been the opposite, it would have been a clear cut case for me.
Another difference: The unlimited find only looks at regular files. But can there be 900MB of directories and symbolic links? |
hmmm ... I see where you are coming from, however, if the directory in the second command, where there is no restriction on file, could easily contain more than files matching the criteria add up to.
My thinking is that whilst the directory now matches the mtime, there may be little to no actual files that do, so the first find would not have gone there. |
Quote:
Quote:
|
All times are GMT -5. The time now is 09:29 PM. |