Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* HELP with remove (rm)
@ 1997-02-11  5:00 Achachila
  1997-02-13  5:00 ` Phil Farrell
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Achachila @ 1997-02-11  5:00 UTC (permalink / raw)



Hi!

Sorry but I am new to Digital Unix, could anyone tell me how can I rm
1000 of files without getting Arg. list to long?

I need to rm something like  *96*

Thanks for any help

Achachila



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: HELP with remove (rm)
  1997-02-11  5:00 HELP with remove (rm) Achachila
@ 1997-02-13  5:00 ` Phil Farrell
  1997-02-13  5:00   ` Steve Jones
  1997-02-13  5:00 ` Lee Doolan
  1997-02-14  5:00 ` Alex Nord
  2 siblings, 1 reply; 5+ messages in thread
From: Phil Farrell @ 1997-02-13  5:00 UTC (permalink / raw)



Achachila wrote:
> Sorry but I am new to Digital Unix, could anyone tell me how can I rm
> 1000 of files without getting Arg. list to long?
> I need to rm something like  *96*

Try:
   find /directory-with-your-files -name "*96*" -exec rm {} \;
This will traverse the directory tree and match and remove files
one by one, rather than trying to make one giant command line 
listing all the files.

-- 
Phil Farrell, Computer Systems Manager
Stanford University School of Earth Sciences
farrell@pangea.stanford.edu



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: HELP with remove (rm)
  1997-02-13  5:00 ` Phil Farrell
@ 1997-02-13  5:00   ` Steve Jones
  0 siblings, 0 replies; 5+ messages in thread
From: Steve Jones @ 1997-02-13  5:00 UTC (permalink / raw)



In article <33037089.68BD@pangea.stanford.edu>,
Phil Farrell  <farrell@pangea.stanford.edu> wrote:
>Achachila wrote:
>> Sorry but I am new to Digital Unix, could anyone tell me how can I rm
>> 1000 of files without getting Arg. list to long?
>> I need to rm something like  *96*
>
>Try:
>   find /directory-with-your-files -name "*96*" -exec rm {} \;
>This will traverse the directory tree and match and remove files
>one by one, rather than trying to make one giant command line 
>listing all the files.
 
See also the "xargs" command for avoiding the limit on the 
size of the argument list in your shell.

For example:
 
  ls | grep 96 | xargs rm
 
-- 
--
  Steven Jones
  Computing & Communications 354843,  University of Washington
  E-mail:  noyd@u.washington.edu    Phone:  (206) 543-5852



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: HELP with remove (rm)
  1997-02-11  5:00 HELP with remove (rm) Achachila
  1997-02-13  5:00 ` Phil Farrell
@ 1997-02-13  5:00 ` Lee Doolan
  1997-02-14  5:00 ` Alex Nord
  2 siblings, 0 replies; 5+ messages in thread
From: Lee Doolan @ 1997-02-13  5:00 UTC (permalink / raw)



In article <3300ea4e.9049223@snews.zippo.com>,
Achachila <nobody@nowhere.org> wrote:
+Hi!
+
+Sorry but I am new to Digital Unix, could anyone tell me how can I rm
+1000 of files without getting Arg. list to long?
+
+I need to rm something like  *96*
+

    try something like

	find dir -name "*96*" -print | xargs rm -f




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: HELP with remove (rm)
  1997-02-11  5:00 HELP with remove (rm) Achachila
  1997-02-13  5:00 ` Phil Farrell
  1997-02-13  5:00 ` Lee Doolan
@ 1997-02-14  5:00 ` Alex Nord
  2 siblings, 0 replies; 5+ messages in thread
From: Alex Nord @ 1997-02-14  5:00 UTC (permalink / raw)
  To: nobody


Achachila wrote:
> 
> Hi!
> 
> Sorry but I am new to Digital Unix, could anyone tell me how can I rm
> 1000 of files without getting Arg. list to long?
> 
> I need to rm something like  *96*
> 
> Thanks for any help
> 
> Achachila
Following is a script I've had sitting around for quite a while.
I've kinda nicknamed it 'rmsome'.  With it, I can also remove files
from, say, an entire month (rmsome Jan), or just a day (rmsome "Jan 21")
because of the -l listing on ls.  

   num=$RANDOM                                   
   ls -l | grep "$1" | cut -c55- > /tmp/kill.$num
   while read i                                  
   do                                            
        rm $i                                 
   done < /tmp/kill.$num                         
   rm /tmp/kill.$num



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1997-02-14  5:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-02-11  5:00 HELP with remove (rm) Achachila
1997-02-13  5:00 ` Phil Farrell
1997-02-13  5:00   ` Steve Jones
1997-02-13  5:00 ` Lee Doolan
1997-02-14  5:00 ` Alex Nord

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox