Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FIND 1

Status
Not open for further replies.

bsek

Technical User
Jan 9, 2003
83
US

Hi,

I want to find all files from last two years on yearwise(1999, 2000,2001,etc.) those files more than 10mb size.
Running Solaris 8.0

Thanks in advance.
 
[tt]find / -type f -a -mtime -1095 -a -size +10485760[/tt]

... would list all files modified in the last three years that are larger than 10MB. Change "mtime" to "atime" if you want to do it based on last accessed time instead of last modified time.

Annihilannic.
 
Hi Annihilannic,

Thanks for reply.
I ran this command twice but did not find any files getting my prompt. I want to find year wise.


bash-2.03# find / -type f -a -mtime -1095 -a -size 10485760
bash-2.03# find / -type f -a -atime -1095 -a -size 10485760
bash-2.03#

Thanks.
 
You missed the "+" before the file size.

I missed the "c" after the file size (to mean bytes and not blocks). It should be:

[tt]find / -type f -a -mtime -1095 -a -size +10485760c[/tt]

I'm not sure what you mean by "find year wise"?



Annihilannic.
 
Thanks for Reply.

Now it listed some files. But I am looking this year files also in this list. I want to find files which are not updated since last two to three years or more in sorted order. I want to see date, time stamp and path on these files.

Thanks.

 
This will list the files with more information:

[tt]find / \( -type f -a -mtime +1095 -a -size +10485760c \) -ls[/tt]

Notice I changed the -1095 to +1095; this will list files modified more than three years ago instead of less than three years ago.

It would probably be best to redirect this output to a file; you could then sort it as you wish using the sort utility.

Alternatively you could try:

[tt]ls -lrt $(find / -type f -a -mtime +1095 -a -size +10485760c)

Annihilannic.
 
Hi Annihilannic,

I created a script to find and sort. These are the commands I have in the script.


find ${PWD} -type f -mount -size +5000000c -exec ls -l {} \; >/tmp/bigfiles$$
sort +4 -5 -n -r /tmp/bigfiles$$
cd /tmp
grep 1999 bigfiles$$ > 1999files


Once again thank you very much for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top