Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 01-25-2005, 04:05 PM   #1
LQ Newbie
Registered: Feb 2004
Posts: 21

Rep: Reputation: 15
Deleting a large number of files

I have a folder that is about 12 gb and is comprised of small files from under a k to 10 k. Everytime I do a rm -f <dir>/* my connection get's booted or if I do a rm -f <dir>/* & I see segmentation fault. My guess it's too many files or something for rm to work with. I was wonder if there was another way I could go about deleting the files.

Thanks, Mark
Old 01-25-2005, 04:13 PM   #2
Registered: Jul 2003
Location: Clinging to my guns and religion.
Posts: 683

Rep: Reputation: 63
so do you need to keep the folder around? If you don't you could always do a 'rm -rf folder_name'

What about going into the directory and deleting a smaller selection with wildcards? like
'rm a*'
Old 01-25-2005, 04:19 PM   #3
LQ Newbie
Registered: Feb 2004
Posts: 21

Original Poster
Rep: Reputation: 15
Not sure why I didn't try just deleting the folder and recreate it.

Thanks for the idea on the wild cards, I have a little script now doing a series of smaller subsections ...

thanks for the ideas.
Old 01-25-2005, 04:21 PM   #4
Senior Member
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
The find command is also handy:
find <dir> -type f -exec rm {} \;
That'll delete all the files in <dir> and all subdirectories. The directory structure will be preserved.
Old 01-26-2005, 02:36 AM   #5
Registered: Aug 2004
Location: /dev/null
Distribution: Slack 10, Debian
Posts: 99

Rep: Reputation: 15
This is a known problem, it can also be gotten around by using something like xargs. I agree with the whole directory thing though.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
assigning a large float number in E notation edM Programming 3 05-09-2005 01:51 PM
Partition shows 99% full even after deleting large files other1 Linux - Newbie 4 04-19-2004 12:18 PM
Large Number of files? mikeshn Linux - Security 2 01-10-2004 07:11 AM
Java: Compile Large number of source files ? mikeshn Programming 7 10-07-2003 12:33 PM
Large number of open ports RefriedBean Linux - Security 3 07-06-2002 12:34 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:22 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration