Deleting numerous files


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Deleting numerous files
# 1  
Old 03-21-2005
Bug Deleting numerous files

Hi there,

I have numerous files in a directory (approx 2500) that I want to delete although I get the following:-

Server> rm *.*
Arguments too long

Is there a proper way of deleting this rather than breaking it down further through the list of files

rm *10.*
rm *11.*
rm *12.*

Cheers,
Hayez
# 2  
Old 03-21-2005
ls *.* | xargs rm
# 3  
Old 03-21-2005
There were more files than I thought:-

server> ls | wc -l
3615
server> ls *.* | xargs rm
Arguments too long
usage: rm [-fiRr] file ...
# 4  
Old 03-21-2005
ls *.* is still trying to build an argument list.

Try:
ls | xargs rm
# 5  
Old 03-21-2005
If you want to remove all the files,
try removing that directory and create the directory again back.

This one fits in only if you want to remove all the files.
# 6  
Old 03-22-2005
if you're still running into issues ... with "ls | xargs rm" ...

try ...

Code:
for i in *
do
    rm $i
done

# 7  
Old 03-22-2005
"for i in *"

Same deal. The shell must replace that * with a list of all files in the current directory.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Split 1 column into numerous columns based on patterns

Hi, I have a text file 'Item_List.txt' containing only 1 column. This column lists different products, each separated by the same generic string header "NEW PRODUCT, VERSION 1.1". After this the name of the product is given, then a delimiter string "PRODUCT FIELD", and then the name of the... (11 Replies)
Discussion started by: mmab
11 Replies

2. Shell Programming and Scripting

Bash script deleting my files, and editing files in subdirectories question

#!/bin/bash # name=$1 type=$2 number=1 for file in ./** do if then filenumber=00$number elif then filenumber=0$number fi tempname="$name""$filenumber"."$type" if (4 Replies)
Discussion started by: TheGreatGizmo
4 Replies

3. Fedora

Concatenate Numerous Files

Hey! I wanted to find a text version of the Bible for purposes of grepping. The only files I could find, (in the translation I wanted), were Old Testament.txt and New Testament.txt. I thought, "fine, I'll just concatenate those two, no problemo." But when I unpacked them, turns out they had each... (22 Replies)
Discussion started by: sudon't
22 Replies

4. Shell Programming and Scripting

How to batch-processing numerous shell scripts?

How to batch-processing numerous shell scripts? how to record the result of all the scripts as a report? then, I can analysis the process result. I want to process numerous shell scripts in my working directory: the directory name is consistent with shell scripts name, that is to say,... (2 Replies)
Discussion started by: qcmao
2 Replies

5. Shell Programming and Scripting

Need to condense numerous IF/ELSE/FI statements into one if possible.

Hi there! Have literally just started using UNIX bash shell again and am writing simple scripts in VI. I basically have a working script but I know without a doubt it could be condensed down to much less code by integrating the individual IF statements. Here is my shoddy code :) ... (5 Replies)
Discussion started by: U_C_Dispatj
5 Replies

6. Shell Programming and Scripting

AIX system.... deleting files in remote directory after retrieving files

Hi Friends, I am new to this , I am working on AIX system and my scenario is to retrive the files from remote system and remove the files from the remote system after retreving files. I can able to retrieve the files but Can't remove files in remote system. Please check my code and help me out... (3 Replies)
Discussion started by: vinayparakala
3 Replies

7. UNIX for Dummies Questions & Answers

bring up/down numerous interfaces

On a Solaris 9 system I had something happen to some of my interfaces; for some reason half of them went down. Since I have over 30 different Virtual IP's (or logical IP's) up on ce10 I don't want to take the time to find out which ones are up and which ones are down or even run the addif command... (2 Replies)
Discussion started by: snoman1
2 Replies

8. Shell Programming and Scripting

Need help comparing two files and deleting some things in those files!

So I have two files: File1 pictures.txt 1.1 1.3 dance.txt 1.2 1.4 treehouse.txt 1.3 1.5 File2 pictures.txt 1.5 ref2313 1.4 ref2345 1.3 ref5432 1.2 ref4244 dance.txt 1.6 ref2342 1.5 ref2352 1.4 ref0695 1.3 ref5738 1.2 ref4948 1.1 treehouse.txt 1.6 ref8573 1.5 ref3284 1.4 ref5838... (24 Replies)
Discussion started by: linuxkid
24 Replies

9. HP-UX

Need to decommission numerous HP N class servers...any thoughts to do quickly?

I have numerous N-class servers with internal and external disks that I need to wipe. Does anyone have any ideas to do this quick and painless. Anything other than a sledge hammer Also, do I need to be in single-user mode and if so how do I do that? Servers are running 11.11 Thanks (3 Replies)
Discussion started by: itry
3 Replies

10. UNIX for Advanced & Expert Users

Making numerous virtual copies of a single file

I have to put a single/identical file to numerous different directories on a website and update them simultaneously and identically. If I have the master file in directory a/, how can I make a "virtual copy" of this file into an other directory, in a way that any changes to the master file will... (2 Replies)
Discussion started by: poredudue
2 Replies
Login or Register to Ask a Question