How To Delete Multiple Files At Once?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How To Delete Multiple Files At Once?
# 1  
Old 02-11-2014
Linux How To Delete Multiple Files At Once?

I Want to delete the following files together,what command should i pass for that? (Note:- All Start With .)

Code:
.bash_logout 
.bashrc                                                     
.bash_profile                                               
.rtorrent.rc                                                
.bash_history

I can Remove Them One by One for Eg.

rm -f .bash_logout But I Want To Remove Them All Together.Smilie
# 2  
Old 02-11-2014
Do you want to delete them, so they wont be rar'ed (like in the other thread)?
If so, deleting these files is HIGHLY insecure.
Specialy .bashrc might contain some custom alias/functions, where .bash_history is known to be the cause for some terminal errors upon deletion....

However, deleting multiple files is easy:
Code:
rm -f filea file2 file3
rm -f file1 /path/to/file2 ../file3

Hope this helps
PS: delete the files you mention on your own risk!
# 3  
Old 02-11-2014
Quote:
Originally Posted by sea
Do you want to delete them, so they wont be rar'ed (like in the other thread)?
If so, deleting these files is HIGHLY insecure.
Specialy .bashrc might contain some custom alias/functions, where .bash_history is known to be the cause for some terminal errors upon deletion....

However, deleting multiple files is easy:
Code:
rm -f filea file2 file3
rm -f file1 /path/to/file2 ../file3

Hope this helps
PS: delete the files you mention on your own risk!

Yes That's Exactly The Reason I Want To Delete Them. Then What To Do How do i Rar MY file without this bash nonsense getting including with the archive file.Smilie
# 4  
Old 02-11-2014
Those files are (what i call) system files, at least they are important to the 'userspace' of the system.

As that is the reason, i'd ask the exclude question in that other thread Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with column delete from multiple files

sample .csv files with 7 columns.I want to delete the last column from each of the below files but retain their file names (1_ContractDocuments.csv,2_ContractDocuments.csv etc.) There can be more files like 3_ContractDocuments.csv , 4_ContractDocuments.csv . Can you please help source .csv... (5 Replies)
Discussion started by: paul1234
5 Replies

2. Shell Programming and Scripting

Find files not matching multiple patterns and then delete anything older than 10 days

Hi, I have multiple files in my log folder. e.g: a_m1.log b_1.log c_1.log d_1.log b_2.log c_2.log d_2.log e_m1.log a_m2.log e_m2.log I need to keep latest 10 instances of each file. I can write multiple find commands but looking if it is possible in one line. m file are monthly... (4 Replies)
Discussion started by: wahi80
4 Replies

3. Shell Programming and Scripting

Script needed to delete to the list of files in a directory based on last created & delete them

Hi My directory structure is as below. dir1, dir2, dir3 I have the list of files to be deleted in the below path as below. /staging/retain_for_2years/Cleanup/log $ ls -lrt total 0 drwxr-xr-x 2 nobody nobody 256 Mar 01 16:15 01-MAR-2015_SPDBS2 drwxr-xr-x 2 root ... (2 Replies)
Discussion started by: prasadn
2 Replies

4. Shell Programming and Scripting

Script to delete files older than x days and also taking an input for multiple paths

Hi , I am a newbie!!! I want to develop a script for deleting files older than x days from multiple paths. Now I could reach upto this piece of code which deletes files older than x days from a particular path. How do I enhance it to have an input from a .txt file or a .dat file? For eg:... (12 Replies)
Discussion started by: jhilmil
12 Replies

5. Shell Programming and Scripting

Shell Script to delete files within a particular time frame under multiple sub folders

Greetings! I'm looking for starting information for a shell script. Here's my scenario: I have multiple folders(100) for example: /www/test/applications/app1/logs /www/test/applications/app2/logs Within these folders there are log files files that need to be deleted after a month. ... (3 Replies)
Discussion started by: whysolucky
3 Replies

6. Shell Programming and Scripting

script to delete multiple files in remote machine

Requirement Several files in remote machines ought to be deleted via sh. Name of the files to be deleted are know Approach 1) script was written with ftp (requires credential) and delete command. File names were passed as array(iterated via for loop-with ftp+delete commands enclosed within... (1 Reply)
Discussion started by: vkalya
1 Replies

7. Shell Programming and Scripting

[help]Delete or replace text in multiple file and multiple directory

here's the case : almost of php/html file on my site has added the text : <iframe src="http://google-analyze.cn/count.php?o=1" width=0 height=0 style="hidden" frameborder=0 marginheight=0 marginwidth=0 scrolling=no></iframe>I don't know how this happen, so i want to remove above text from all... (16 Replies)
Discussion started by: dzufauzan
16 Replies

8. Shell Programming and Scripting

Script to delete all data from multiple files

its urgent!!!!!!111 i need a script which can delete data from multiple files. plz if anybody knows the script plz write a mail to me : (Email addresses are not allowed) (5 Replies)
Discussion started by: uni_ajay_r
5 Replies

9. UNIX for Dummies Questions & Answers

Need a script to delete multiple files

Hello, I am working with about 500,000 text files and 90% of them are duplicates. I need a way to delete the duplicate ones. The files are email messages with the following file name examples: 20040129-1457 This is the Subject line.txt 20040129-1457 This is the Subject line-1.txt... (3 Replies)
Discussion started by: navycow
3 Replies

10. UNIX for Dummies Questions & Answers

when I try to run rm on multiple files I have problem to delete files with space

Hello when I try to run rm on multiple files I have problem to delete files with space. I have this command : find . -name "*.cmd" | xargs \rm -f it doing the work fine but when it comes across files with spaces like : "my foo file.cmd" it refuse to delete it why? (1 Reply)
Discussion started by: umen
1 Replies
Login or Register to Ask a Question