LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-06-2012, 01:53 AM   #1
Huamin
Member
 
Registered: May 2011
Posts: 562

Rep: Reputation: 12
rm Dir


Hi,
If I run this
rm -R directoryname/*

it will confirm to delete each file one by one. How to force it to delete all?

Many Thanks & Best Regards,
HuaMin
 
Old 06-06-2012, 01:57 AM   #2
corbintechboy
Member
 
Registered: Sep 2003
Location: Kentucky
Posts: 480
Blog Entries: 1

Rep: Reputation: 51
Quote:
Originally Posted by Huamin View Post
Hi,
If I run this
rm -R directoryname/*

it will confirm to delete each file one by one. How to force it to delete all?

Many Thanks & Best Regards,
HuaMin
rm -rf
 
1 members found this post helpful.
Old 06-06-2012, 02:05 AM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
If you have to confirm the deletion (which is not the default behavior for rm) then most likely you have an alias in your shell's configuration file that adds the -i option for rm. If you use /usr/bin/rm instead of rm in your command the alias will not be used and you will not be asked for confirmation.
 
Old 06-06-2012, 11:29 AM   #4
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
There are several other ways to bypass aliases as well:

How to ignore aliases or functions when running a command?
http://mywiki.wooledge.org/BashFAQ/086

And read the rm man page for details on the options available to you. Using -I in your alias will have it prompt you only once when deleting multiple files, for example.

Note also that, for the majority of tools, when you give multiple conflicting options the last one supplied generally takes precedence. So you can probably just add -f to your command to override the -i supplied by the alias.
 
1 members found this post helpful.
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Read file names in a Dir and its Sub Dir in Perl sagarkha Programming 2 04-28-2010 04:58 PM
Web Root Dir Change and New Dir Added issue in CentOS 5 Ginnyz Linux - Server 2 06-01-2009 08:29 PM
Command to display /dir, /dir/sub, /dir/sub/files knockout_artist Linux - Newbie 9 10-25-2007 02:57 PM
Q. moving /bin dir files to /dev dir?? Texas_student Linux - Software 2 03-26-2006 11:42 PM
Share configuratin dir (.dir) for 3 accounts on local computer LiNuXkOlOnIe Linux - Software 5 01-08-2006 03:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:16 PM.

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