Solved

Delete lot of files in solaris

Posted on 2011-09-13
4
375 Views
Last Modified: 2012-05-12
Hi,

I have lots of files (nearly 900000)in a directory and I need to remove files older than 30 days in a quick way.

I tried to execute  find . -name "*____.tmp"  -mtime +30 -exec rm -rf {} \;

but it is too long time.

Regards
Chinna
0
Comment
Question by:tnrchinna
  • 2
4 Comments
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 36534134
find . -name "*____.tmp" -mtime +30 | xargs rm -f
0
 
LVL 16

Expert Comment

by:Peter Kwan
ID: 36534135
How about creating a temp directory and moving the files to the temporary directory, then remove the whole temp directory? Like this:

find . -name "*____.tmp"  -mtime +30 -exec mv {} /tmpdir \;
rm -rf /tmpdir
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 36534457
Do you have to process files in subdirectories?

If you don't you could speed up the whole thing a bit (depending on the actual number of subdirs, of course):

find . \( -type d \! -name '.' -prune \)  -o -type f -name "*____.tmp" -mtime +30 | xargs rm -f

If you have GNU find installed:

find . -maxdepth 1 -type f -name "*____.tmp" -mtime +30 | xargs rm -f

wmp

0
 

Author Closing Comment

by:tnrchinna
ID: 36541008
I tried all the ways, mentioned above only last one better than all. Initiating during downtime and it is still taking long time but no option.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now