Finding files by specifying
their modification time
The find command is one of the most flexible and powerful commands in the Solaris operating system. You can use it to find files with almost any search criteria and then perform operations on the files it finds. As an example, suppose you created a file in the /home/fregal directory within the last 30 days, but you can't remember the name of the file. To search for all files that were modified in the /home/fred directory within the last 30 days, use the following command:
$ find /home/fregal -mtime -30 -ok rm {}\;
if you know the file name you can specify
find / -name -mtime 30 -exec rm {}\;
Suppose, however, that you created the file more than 30 days ago. To search for files in this directory modified more than 30 days ago, simply change the -30 to +30:
$ find /home/fregal -mtime +30 -exec rm {} \;
Finally, if you somehow knew that you modified the file exactly 30 days ago, exclude the sign on the number 30 altogether to search for files modified exactly 30 days ago and delete it
$ find /home/fregal -mtime 30 -exec rm -r {}\;
for deleting
$ find /home/fregal -size 1000 -exec rm {} \;
$
.
F. regal
good luck
"think twice and hit enter once"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.