LinuxQuestions.org
Social Bookmarking all things Linux and Open Source
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Newbie
User Name
Password
Linux - Newbie This forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Tags used in this thread
Popular LQ Tags , ,

Reply
 
Thread Tools
Old 08-17-2009, 11:12 AM   #16
:::
Member
 
Registered: Aug 2009
Distribution: slackware 12.2
Posts: 51
Thanked: 4

[Log in to get rid of this advertisement]
Quote:
Originally Posted by Paraply View Post
"rm -r ./*_files" --> works, but only in the first directory. It looks to me as if "./" is disabling the recursive functionality.

What am I doing wrong?
the ability of the humans mind to associate and to "understand" what others mean is called empathy. it isn't implemented in any computer yet, as far as i know. you have to exactly tell the computer what it should do. they are not good at guessing .

the "-r" option tell rm to remove a directory by recursivly travelling it down and removing each and every file/dir in it up to the top directory.

the command "rm -r ./*_files" does the following:
1. check the directory "./" for entries (inodes) matching the pattern "*_files".
2. if you find one, remove it (recursivly if necessary, i.e. if it's a directory)

it does not mean "travel all the subdirs in "./" recursivly till you find an entry matching the pattern "*_files" and then remove it recursively. your command implies to recursions yet you have told the bash only of one. in other words: if you have a directory ./somedir/dir_files/ the above command will not find the dir "dir_files" because "rm" only searches the directory "./" (note: the "-r" option doesn't mean "search recursivly" but "remove recursivly")

to solve your problem you should use find and xargs:
Code:
find ./ -name '*_files' | xargs rm -r
but try this command first without xargs and check the output to make sure it found all files correctly.

cheers :::

p.s. these live topics kill me. there was one answer when wrote my reply just to find out that meanwhile other recommended the same and a lot easier.

Last edited by :::; 08-17-2009 at 11:16 AM..
::: is offline     Reply With Quote


Old 08-17-2009, 11:14 AM   #17
catkin
Senior Member
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Slackware 13.0
Posts: 1,864
Blog Entries: 6
Thanked: 226
Quote:
Originally Posted by Paraply View Post
somehow I seem to get totally lost whenever I try perusing 'man find'...
With you there! A key concept is that find arguments are a series of tests followed by actions performed if the tests are passed.
catkin is offline     Reply With Quote


Old 08-17-2009, 11:44 AM   #18
Paraply
Member
 
Registered: Jun 2007
Posts: 34
Thanked: 0

Original Poster
Quote:
Originally Posted by onebuck View Post
Hi,

Glad to hear you got what you want.

Sorry about the mix up.

(...)
Hi Gary,

no problem. Now

Thanks for the links. Actually, I have gigabytes of Linux books and tutorials on my system and after about two years with Linux one should think I'd found the time to learn at least the elementary stuff. Alas, not so. Or I learn a few tricks and then go and forget them... I even have a Slackware derivative, Bluewhite, installed. Apparently it has not helped any... My consolation, or excuse, is that I am spending most of my time with non-technical stuff. Thanks to LinuxQuestions.org, people like me are still partly functional

Last edited by Paraply; 08-17-2009 at 11:46 AM..
Paraply is offline     Reply With Quote


Old 08-17-2009, 12:02 PM   #19
Paraply
Member
 
Registered: Jun 2007
Posts: 34
Thanked: 0

Original Poster
Quote:
Originally Posted by ::: View Post
(...)
p.s. these live topics kill me. there was one answer when wrote my reply just to find out that meanwhile other recommended the same and a lot easier.
Oh, but you gave me another, different gem to save. Thanks! Yes, computers are still seriously lacking in empathy, but I hear they are working on that - what with 'quantum computers', 'AI' and all. However, since nobody seems able to figure out Bell's Theorem, we may still have to wait a while before Haskell can be put to serious use...?

@catkin: Thanks for the tip!
Paraply is offline     Reply With Quote


Old 08-17-2009, 02:39 PM   #20
onebuck
Guru
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 5,451
Blog Entries: 1
Thanked: 204
Hi,

Like most say 'use it or lose it'.
onebuck is offline     Reply With Quote


Old 08-18-2009, 12:53 AM   #21
casperdaghost
LQ Newbie
 
Registered: Aug 2009
Posts: 27
Thanked: 0
a guy at work created a script with rm and a 'catch all' ..... * to get rid of core files.
something very very bad happened.

be careful with rm
casperdaghost is offline     Reply With Quote


Old 08-18-2009, 10:03 AM   #22
onebuck
Guru
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 5,451
Blog Entries: 1
Thanked: 204
Hi,

Whenever testing or experimenting you should never work on a production machine.
onebuck is offline     Reply With Quote



Reply

Bookmarks


Thread Tools

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
"Ending Session" Problem mickeyboa Fedora 2 03-11-2008 10:32 AM
smb.conf having share names ending in "$" the_imax Linux - Server 3 03-11-2008 06:50 AM
shell script to recursively "compare" all files in a directory... silex_88 Programming 3 05-12-2007 05:24 AM
LXer: Displaying "MyComputer", "Trash", "Network Servers" Icons On A GNOME Desktop LXer Syndicated Linux News 0 04-02-2007 09:31 AM
Recursively deleting ".directory" Frank616 Linux - Software 2 03-26-2005 12:58 AM


All times are GMT -5. The time now is 08:58 PM.

Main Menu
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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration