The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
fast search and replace in all files dbsurf Shell Programming and Scripting 21 02-01-2008 03:42 AM
Delete a directory - very fast jingi1234 UNIX for Advanced & Expert Users 3 09-20-2006 03:38 PM
how to delete log files castlerock Shell Programming and Scripting 2 03-29-2006 03:42 PM
when I try to run rm on multiple files I have problem to delete files with space umen UNIX for Dummies Questions & Answers 1 09-20-2005 03:20 AM
I can't delete some files DISTURBED UNIX for Dummies Questions & Answers 4 08-01-2002 11:15 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-30-2007
tonyvirk tonyvirk is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 5
What's the fast way to delete these files?

Hi,

I had this request from user which I completed by using rm for all these files but I am wondering if there was way to finish it faster rather going through one file at a time.


Please check attached text file to see file names. Thanks!
Attached Files
File Type: txt filestoremove.txt (29.4 KB, 126 views)
  #2 (permalink)  
Old 12-30-2007
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,509
why do you have rm in front of all those file names? are they your actual file names?
  #3 (permalink)  
Old 12-30-2007
botao's Avatar
botao botao is offline
Registered User
  
 

Join Date: Mar 2006
Location: brazil
Posts: 38
use regular expressions

first, to make sure, check with

ls -l aaaaa2007* llff2007*

to see that these are the ones you want to remove, then

rm aaaaa2007* llff2007*

good luck, and success !
  #4 (permalink)  
Old 12-30-2007
reborg's Avatar
reborg reborg is online now Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,209
In terms of efficiency, using one rm per file is not efficient, as it requires a
fork and exec for each rm.

In a gneric situation if you try to remove all the files in one batch the number of arguments could be too big for the command.

Assuming you have a file with a list of files to remove in a file called list.txt something like this would be more efficient:
Code:
xargs -i rm {} < list
  #5 (permalink)  
Old 01-01-2008
tonyvirk tonyvirk is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 5
ghostdog,

I used rm to remove those files so thats why I have it in there. I forgot to remove it when I posted that file here. Sorry for the confusion. Thanks!


botao,

Thanks! I will try that next time I get request like this instead of using rm with one file at a time.


reborg,

Could you please elaborate on your command line? As I understood from post that I can simply get all the files names in one file with txt extension and then execute the following?

xargs -i rm {} < list

Thanks! for the help everyone. I really appreciate your help.
Closed Thread

Bookmarks

Tags
regex, regular expressions

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:18 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0