1748011 Members
3477 Online
108757 Solutions
New Discussion юеВ

Re: Powerfull Find

 
SOLVED
Go to solution
James R. Ferguson
Acclaimed Contributor

Re: Powerfull Find

Hi (again):

> Dears Dennis Handly and James R. Ferguson, I have this idea already, creating a script and calling it from find command.

Well, that's exactly what Dennis suggested originally to you! I presented an alternative, less direct answer to your original query (using 'find' and a pipe to 'cpio'). I think you have everything you need to make your decision.

Regards!

...JRF...
AZayed
Super Advisor

Re: Powerfull Find

Hi all, and thanks for your all ideas,

Dear Kevin, I would like to ask you about the "!" mark. if you put it before -newer option is it mean find older files not newer onec ?

I think I can solve this by moving the all directory to temporary directory and then find all the files newer than certain date as Kevin suggest and the returen those back with there directories to source directory. doing this I can save a lot of I/O because I'm dealing with more than 2,500,000 files.

-----------------

Again Kevin, thank for -prune option, I will write tomorowo script that have to go to every directory and count the number of files. So, I think this can help me with find.

-----------------

Dear JRF, I will read more about cpio, and feedback soon.

Thanks all.
Success seems to be connected with action. Successful people keep moving. They make mistakes, but they don't quit.
Dennis Handly
Acclaimed Contributor

Re: Powerfull Find

>ask you about the "!" mark. if you put it before -newer option is it mean find older files not newer onec?

The opposite of newer is "NOT newer". Which is older or the same time.

>I think I can solve this by moving the all directory to temporary directory

What's wrong with my "mv" solution? (You can still use -newer if you want.)
AZayed
Super Advisor

Re: Powerfull Find

Hi folks,

I would like to ask about -mtime option.

In case you need to take all the files that were modified more than to days you need to use "-mtime +2". But this actually not finding all the files. Is this happened with you guys?

I have to put another find with -mtime 2 option to achieve my goal.

Any ideas ?
Success seems to be connected with action. Successful people keep moving. They make mistakes, but they don't quit.
Dennis Handly
Acclaimed Contributor

Re: Powerfull Find

>I have to put another find with -mtime 2 option to achieve my goal.

What's your goal? -mtime +2 should be all files modified more than 2*24 hours ago.
Have you read find(1)?
http://docs.hp.com/en/B2355-60130/find.1.html
AZayed
Super Advisor

Re: Powerfull Find

Hi Dennis,

I want to know the difference between -mtime 1 & -mtime +1. In Sun +1 mean find all files that modified time is more than 24 hour.

Look at this:

touch -t 0810250000 file
touch -t 0810260000 file1
touch -t 0810270000 file2
touch -mt 0810270000 file3
touch -mt 0810260000 file4

#ls :

Oct 25 00:00 file
Oct 26 00:00 file1
Oct 26 00:00 file4
Oct 27 00:00 file2
Oct 27 00:00 file3

# find . -mtime +1
./file
# find . -mtime 1
./file1
./file4

----

I think "find . -mtime +1" suppose to display "find . -mtime 1" result.

Thanks
Success seems to be connected with action. Successful people keep moving. They make mistakes, but they don't quit.
Aneesh Mohan
Honored Contributor

Re: Powerfull Find

Hi Ahmed,


+n means more than n, -n means less than n, and n means exactly n.

here it is n * 24 hours.


Aneesh
AZayed
Super Advisor

Re: Powerfull Find

Hi,

So why the first command didn't find ./file1 , ./file4 files ?

Regards,
Success seems to be connected with action. Successful people keep moving. They make mistakes, but they don't quit.
Aneesh Mohan
Honored Contributor

Re: Powerfull Find

Hi Ahmad,

Try #find . -mtime +0 you will get it .

fyi:-
True if the file modification time subtracted
from the initialization time is n-1 to n
multiples of 24 h. The initialization time
shall be a time between the invocation of the
find utility and the first access by that
invocation of the find utility to any file
specified in its path operands.


Aneesh

Dennis Handly
Acclaimed Contributor

Re: Powerfull Find

>So why the first command didn't find ./file1, ./file4 files?

How can we tell if you don't tell us what time it is?
From find(1) there is a 24 hour fuzziness in -mtime n, perhaps there is for +n?