LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 01-25-2005, 04:05 PM   #1
msteudel
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
Blinker_Fluid
Member
 
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
msteudel
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
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
The find command is also handy:
Code:
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
realjustin
Member
 
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.
 
  


Reply


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

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:20 AM.

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