Could not able to delete the files through find command need expert advice


 
Thread Tools Search this Thread
Operating Systems Solaris Could not able to delete the files through find command need expert advice
# 1  
Old 01-20-2010
Could not able to delete the files through find command need expert advice

Hi Gurus

I am facing a problem, there is a folder called /a where there are lots of files which are occupying space anything between 30 GB to 100 GB as I am not able to check the space occupied by that folder through "du -sh /a" command as I don't see any output after more than 1 hour of running the command, I believe that it hung. Even I don't able to see the files listing after more than half an hour through ls -ltr command then I cancel the command. At the same tine I am 100% sure that files are contiously creating in that folder & every thing is at SAN storage level though LUN.

Now my main problem is that I need to free some space from that folder & we have made a policy that folder must contain last 6 month files but I believe that folder has files more than 1.5 year old. Now I need to delete the files. If I try to delete the files through find command at once which are older than last six month , it goes into hung & didn't delete the files

Kindly help me in this regard
# 2  
Old 01-20-2010
You have too many files in one directory. All of those commands - ls, find, and so on: they all call readdir(). Show the output of

Code:
ls -ld  /a

The directory file itself is probably enormous. Which is why it takes forever to process.
The find, ls or whatever is NOT hanging up it is just grinding thru a ridiculously large directory.
# 3  
Old 01-20-2010
Quote:
Originally Posted by amity
Hi Gurus

I am facing a problem, there is a folder called /a where there are lots of files which are occupying space anything between 30 GB to 100 GB as I am not able to check the space occupied by that folder through "du -sh /a" command as I don't see any output after more than 1 hour of running the command, I believe that it hung. Even I don't able to see the files listing after more than half an hour through ls -ltr command then I cancel the command. At the same tine I am 100% sure that files are contiously creating in that folder & every thing is at SAN storage level though LUN.

Now my main problem is that I need to free some space from that folder & we have made a policy that folder must contain last 6 month files but I believe that folder has files more than 1.5 year old. Now I need to delete the files. If I try to delete the files through find command at once which are older than last six month , it goes into hung & didn't delete the files

Kindly help me in this regard
hi.,
Maybe you have directories within directories and find is going into it and getting lost somewhere. lol
so add -maxdepth 1 to your find command and see it it doesnt make you wait for hours (choke). If it works out then go ahead and make it 2,3 etc. ..

Regards
Gaurav.
# 4  
Old 01-21-2010
Is your /a a local mount point or its from an array Lun or it is NFS mounted?
When you did the command, and you said "hung", can you provided if there's any errors or warnings in the messages file ? (if any)
# 5  
Old 01-21-2010
Quote:
Originally Posted by incredible
Is your /a a local mount point or its from an array Lun or it is NFS mounted?
When you did the command, and you said "hung", can you provided if there's any errors or warnings in the messages file ? (if any)
"BY Hung" he probably means to say that find wrote anything to stdout.Thought it may have been computing in the background.

I pretty much think that find was not able to reach the leaf of a directory(i.e. a file) .
So try with maxdepth and also try the -print0(if you think that it simply hung).

Regards
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find command to delete the files

Hi All, I've created 2 files touch -t 201309101234 aa10 touch -t 201309111234 aa11 Exact 60 days before from today date is SEPT 12th . As per the following command as i gave +60 means the files which were created before sept12th should be deleted find /etc/logs/*aa* -type f -atime +60... (5 Replies)
Discussion started by: smile689
5 Replies

2. Shell Programming and Scripting

Find modify and delete files

hi every one. one of my friends has writen this script and send it to me. this script can find files that add-delete-modify and also send an alert by email i'm not catch all part of it. can anyone explain me how this work #!/bin/bash START="a.txt" END="b.txt" DIFF="c.txt" mv ${START}... (4 Replies)
Discussion started by: nimafire
4 Replies

3. UNIX for Dummies Questions & Answers

Find command to delete old files

Hi, I want to delete all the log files that was created on year 2008. My command is not working. Any idea? find . -name '*.log' -mtime 1460 -exec ls -lt {} \; Thank you. (2 Replies)
Discussion started by: samnyc
2 Replies

4. Shell Programming and Scripting

Find command to search and delete files older than 1 days at a desired location

Hello All, Can someone please help me out in creating the find command to search and delete files older than 1 days at a desired location. Thanks in advance for your help. (3 Replies)
Discussion started by: Pandee
3 Replies

5. Shell Programming and Scripting

Find command to delete a pattern

Hi all i have a directory where it has files as shown below.Using find command how can i delete files which were modified more than 20 days ago and having the pattern jnhld15231 or jnhld15232. find ./ -name "jnhld15231^" -type f -mtime +20 -exec rm {} \; find ./ -name "jnhld15232^" -type f... (2 Replies)
Discussion started by: morbid_angel
2 Replies

6. Shell Programming and Scripting

find files for a particular date and delete

How can I delete files for a particular date ? I apologize in advance If there is solution please put the link. Thanks, (5 Replies)
Discussion started by: jville
5 Replies

7. UNIX for Dummies Questions & Answers

find and delete files

hi all , i want to find and interactively delete all the files having size greater than 20 bytes using "find" and other commands..... (8 Replies)
Discussion started by: sonu_pal
8 Replies

8. Solaris

Strange problem need expert advice

Hey guys I am into strange problem where I have to integrate cluster and EMC storage for that I have to take 1 NIC port from default nic port present on the server and 3 NIC port from quad card which is also present on the server. Right now I have connect all ports to a network for testing... (6 Replies)
Discussion started by: amity
6 Replies

9. UNIX for Dummies Questions & Answers

find and delete a file in one command

hi , let's assume i have a file that is located in the l*** directory and this file's name is t****_***s.php , how can i find this file and delete it using one single command ????? (3 Replies)
Discussion started by: wewee
3 Replies

10. Solaris

How to delete Directory and inside files using Find command

I am using the following Command to delete Directory with contents. But this command is deleting inside files only not directories. is there any change need in my command? find -type f -mtime +3 -exec rm -r {} \; Thanks (3 Replies)
Discussion started by: bmkreddy
3 Replies
Login or Register to Ask a Question