|
Home > Archive > alt.os.linux > October 2002 > Deleting recursive directories
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Deleting recursive directories
|
|
| Todd Cary 2002-10-02, 12:51 pm |
| First, I am a newbie with the Linux environment, so my
question/understanding of what has happened reflects that.
Someone FTP a file to my RH Linux FTP site. Not sure what happened, but
the same directory in within the same directory, etc.. Looking at them
with Samba and Windoze shows the recursive nature and following the path
for several iterations with cd's and "ls -l" shows the same thing.
Can I delete all of these without doing something horrible (like
destroying the file system)? And if I can, how do I recursively delete
all directories and the contents?
Todd
--
Todd Cary
Ariste Software
2200 D Street Extension
Petaluma, CA 94952
707-773-4523
todd@aristesoftware.com
[It is simplicity that makes the uneducated more effective than
the educated when addressing popular audiences. - Aristotle]
| |
| Kosh Vader 2002-10-02, 12:51 pm |
| On Wed, 02 Oct 2002 00:08:58 GMT, Todd Cary <todd@aristesoftware.com>
wrote:
>First, I am a newbie with the Linux environment, so my
>question/understanding of what has happened reflects that.
>
>Someone FTP a file to my RH Linux FTP site. Not sure what happened, but
>the same directory in within the same directory, etc..
As in "junk/junk/junk/..."?
>Looking at them
>with Samba and Windoze shows the recursive nature and following the path
>for several iterations with cd's and "ls -l" shows the same thing.
>
>Can I delete all of these without doing something horrible (like
>destroying the file system)? And if I can, how do I recursively delete
>all directories and the contents?
Use the "rm -rf ...", where "-r" is recursive remove, and "-f" is
force remove. Just keep sure you are careful with its use! Use
the "-i" option (interactive yes/no) too if desired.
Chris
| |
| Garry Knight 2002-10-02, 12:51 pm |
| Todd Cary wrote:
> how do I recursively delete all directories and the contents?
One of at least 3 ways:
1) From the command line: cd to the directory above the ones you want to
delete, then enter (carefully) "rm -rf *" or "rm -rf directory/" to just
remove one directory and all its subdirectories. You can use this with an
absolute path such as "rm -rf /var/ftp/pub/loser/made/these/".
2) In Midnight Commander (mc) navigate to the directory above the ones you
want to delete, mark the subdirectories in that directory that you want to
delete, by moving the cursor to them and pressing the Ins key. Now press F8
to delete the lot. Follow the prompts to make sure the delete is recursive.
3) In any GUI file manager, navigate to the directory above the ones you
want to delete, select the subdirectories to delete (using Ctrl+left click)
then right-click one of them and select "Delete".
Next...?
--
Garry Knight
garryknight@gmx.net ICQ: 126351135
Linux registered user 182025
| |
| Brian Reichle 2002-10-02, 12:51 pm |
| Todd Cary wrote:
> First, I am a newbie with the Linux environment, so my
> question/understanding of what has happened reflects that.
>
> Someone FTP a file to my RH Linux FTP site. Not sure what happened, but
> the same directory in within the same directory, etc.. Looking at them
> with Samba and Windoze shows the recursive nature and following the path
> for several iterations with cd's and "ls -l" shows the same thing.
>
> Can I delete all of these without doing something horrible (like
> destroying the file system)? And if I can, how do I recursively delete
> all directories and the contents?
>
> Todd
>
man rm
rm -rf <evildir>
| |
| Todd Cary 2002-10-02, 12:51 pm |
| Many thanks! I was looking at rmdir rather than rm. It appears that
rmdir can be viewed as a subset of rm.
Nevertheless, it worked like a champ.
--
Todd Cary
Ariste Software
2200 D Street Extension
Petaluma, CA 94952
707-773-4523
todd@aristesoftware.com
[It is simplicity that makes the uneducated more effective than
the educated when addressing popular audiences. - Aristotle]
| |
| Paul Lutus 2002-10-02, 12:51 pm |
| Todd Cary wrote:
> Many thanks! I was looking at rmdir rather than rm. It appears that
> rmdir can be viewed as a subset of rm.
In any case, the object in question, a symbolic link, isn't a directory
entry but a file entry. "rm" is the correct choice primarily because the
thing being deleted is not a directory.
--
Paul Lutus
www.arachnoid.com
| |
| Lew Pitcher 2002-10-02, 12:51 pm |
| On Wed, 02 Oct 2002 09:51:27 -0700, in alt.os.linux, Paul Lutus
<nospam@nosite.zzz> wrote:
>Todd Cary wrote:
>
>> Many thanks! I was looking at rmdir rather than rm. It appears that
>> rmdir can be viewed as a subset of rm.
>
>In any case, the object in question, a symbolic link, isn't a directory
>entry but a file entry.
????
Paul: Aren't you the one asserting most vehemently in comp.os.linux.setup
that only "file"s are files? Given your stance there, how can a symlink be
a "file entry"?
>"rm" is the correct choice primarily because the
>thing being deleted is not a directory.
>
>--
>Paul Lutus
>www.arachnoid.com
>
Lew Pitcher, Information Technology Consultant, Toronto Dominion Bank Financial Group
(Lew_Pitcher@td.com)
(Opinions expressed are my own, not my employer's.)
| |
| Paul Lutus 2002-10-02, 4:25 pm |
| Lew Pitcher wrote:
> On Wed, 02 Oct 2002 09:51:27 -0700, in alt.os.linux, Paul Lutus
> <nospam@nosite.zzz> wrote:
>
>>Todd Cary wrote:
>>
>>> Many thanks! I was looking at rmdir rather than rm. It appears that
>>> rmdir can be viewed as a subset of rm.
>>
>>In any case, the object in question, a symbolic link, isn't a directory
>>entry but a file entry.
>
> ????
>
> Paul: Aren't you the one asserting most vehemently in comp.os.linux.setup
> that only "file"s are files? Given your stance there, how can a symlink be
> a "file entry"?
Why do you think I chose this particular wording? I thought this over before
posting, knowing someone might notice just what you did. The thing being
described is certainly not a file, nor is it a directory. It is an entry in
a filesystem directory (an inode), and in the original it's language
suitable for a nonspecialist. Think -- how would you describe a symlink or
an inode if you wanted to avoid specialized language?
There are plenty of things in the filesystem that are more like files than
they are like directories. Only directories are proper subject matter for
"rmdir," the rest are something else, things suitable to "rm".
In any case, why should I inflict the content of that dreadful thread on
this innocent poster? I really don't see the point. "rm" appears to be able
to delete anything (not true, but never mind). To the nonspecialist, this
means files as well as directories. And those things that "rm" can't (or
shouldn't) delete appear to be items of evidence against "everything is a
file," at least to me.
--
Paul Lutus
www.arachnoid.com
| |
| Lee Sau Dan 2002-10-07, 4:24 am |
| >>>>> "Paul" == Paul Lutus <nospam@nosite.zzz> writes:
Paul> Why do you think I chose this particular wording? I thought
Paul> this over before posting, knowing someone might notice just
Paul> what you did. The thing being described is certainly not a
Paul> file, nor is it a directory. It is an entry in a filesystem
Paul> directory (an inode),
Not exactly. An inode is an entry in the fs's inode table, indexed by
the inode number. Each file has its own inode. What is in a
directory is just the pair (name, inode-number), not the inode itself.
Paul> There are plenty of things in the filesystem that are more
Paul> like files than they are like directories. Only directories
Paul> are proper subject matter for "rmdir," the rest are
Paul> something else, things suitable to "rm".
Or even more accurately, unlink(2).
Paul> In any case, why should I inflict the content of that
Paul> dreadful thread on this innocent poster? I really don't see
Paul> the point. "rm" appears to be able to delete anything (not
Paul> true, but never mind). To the nonspecialist, this means
Paul> files as well as directories. And those things that "rm"
Paul> can't (or shouldn't) delete appear to be items of evidence
Paul> against "everything is a file," at least to me.
Yeah. But this "a directory is not really a file" thing is so deep in
the unix design that it is not easy to change. There are OSes that
separate "files" from "directories". There, directories are just
lookup tables for name -> unique_file_id. They don't have to be
provided from the same machine where the files are actually stored.
--
Lee Sau Dan §õ¦u´°(Big5) ~{@nJX6X~}(HZ)
E-mail: danlee@informatik.uni-freiburg.de
Home page: http://www.informatik.uni-freiburg.de/~danlee
|
|
|
|
|