POV-Ray : Newsgroups : povray.off-topic : Today's annoyance Server Time
29 Jul 2024 10:30:35 EDT (-0400)
  Today's annoyance (Message 1 to 10 of 10)  
From: Invisible
Subject: Today's annoyance
Date: 9 Feb 2012 09:23:21
Message: <4f33d6d9$1@news.povray.org>
Under Unix, if you say

   rm file1

it deletes the specified file. If you say

   rm folder1

it deletes the specified folder. So far so good, eh?

Now consider CMD.EXE, the Windows NT command processor. If you do

   DEL file1

it deletes the specified file. If you now say

   DEL folder1

it asks you "are you sure?". If you add the /Q switch, it will just 
delete the folder... hahaha! No, it won't. Actually, it merely deletes 
the /contents/ of the folder. Actually, you know what? No it doesn't. It 
deletes the /files/ within the folder. Unless you add /S (recursive 
delete), in which case all files in all folders are deleted, but the 
folders themselves remain.

In order to /actually/ delete a folder, you must do

  RMDIR folder1

Oh, but that fails if the folder is not empty, so you must add /S. Oh, 
but that asks for confirmation, so you must add /Q as well.

Short version: To delete an object, you must know whether it is a file 
or a folder. Thanks for that... :-P

Special bonus for failing to document this fact anywhere. (E.g., the 
manual for DEL doesn't mention that there's an RMDIR command.)


Post a reply to this message

From: nemesis
Subject: Re: Today's annoyance
Date: 9 Feb 2012 12:15:01
Message: <web.4f33fedecfe4adb6773c9a3e0@news.povray.org>
Invisible <voi### [at] devnull> wrote:
> Under Unix, if you say
>
>    rm file1
>
> it deletes the specified file. If you say
>
>    rm folder1
>
> it deletes the specified folder. So far so good, eh?
>
> Now consider CMD.EXE, the Windows NT command processor. If you do
>
>    DEL file1
>
> it deletes the specified file. If you now say
>
>    DEL folder1
>
> it asks you "are you sure?". If you add the /Q switch, it will just
> delete the folder... hahaha! No, it won't. Actually, it merely deletes
> the /contents/ of the folder. Actually, you know what? No it doesn't. It
> deletes the /files/ within the folder. Unless you add /S (recursive
> delete), in which case all files in all folders are deleted, but the
> folders themselves remain.
>
> In order to /actually/ delete a folder, you must do
>
>   RMDIR folder1
>
> Oh, but that fails if the folder is not empty, so you must add /S. Oh,
> but that asks for confirmation, so you must add /Q as well.
>
> Short version: To delete an object, you must know whether it is a file
> or a folder. Thanks for that... :-P
>
> Special bonus for failing to document this fact anywhere. (E.g., the
> manual for DEL doesn't mention that there's an RMDIR command.)

there actually is rmdir in Unix too.  And rm dir will only work with the -r
recursive switch.  Unless you simply use rmdir dir, that deletes dir and all.


Post a reply to this message

From: Orchid Win7 v1
Subject: Re: Today's annoyance
Date: 9 Feb 2012 14:15:19
Message: <4f341b47$1@news.povray.org>
On 09/02/2012 17:14, nemesis wrote:

> there actually is rmdir in Unix too.  And rm dir will only work with the -r
> recursive switch.  Unless you simply use rmdir dir, that deletes dir and all.

I think -r for "recursive" is more logical than /S, but whatever. And 
isn't it -rf actually? I seem to recall that otherwise it asks for 
confirmation...

I've never seen nor heard of rmdir.


Post a reply to this message

From: Jim Henderson
Subject: Re: Today's annoyance
Date: 9 Feb 2012 14:38:17
Message: <4f3420a9@news.povray.org>
On Thu, 09 Feb 2012 19:15:13 +0000, Orchid Win7 v1 wrote:

> On 09/02/2012 17:14, nemesis wrote:
> 
>> there actually is rmdir in Unix too.  And rm dir will only work with
>> the -r recursive switch.  Unless you simply use rmdir dir, that deletes
>> dir and all.
> 
> I think -r for "recursive" is more logical than /S, but whatever. And
> isn't it -rf actually? I seem to recall that otherwise it asks for
> confirmation...
> 
> I've never seen nor heard of rmdir.

/S = subtree

Jim


Post a reply to this message

From: Warp
Subject: Re: Today's annoyance
Date: 10 Feb 2012 07:48:20
Message: <4f351214@news.povray.org>
nemesis <nam### [at] gmailcom> wrote:
> there actually is rmdir in Unix too.  And rm dir will only work with the -r
> recursive switch.  Unless you simply use rmdir dir, that deletes dir and all.

  Actually rmdir will remove a directory only if it's empty.

-- 
                                                          - Warp


Post a reply to this message

From: Warp
Subject: Re: Today's annoyance
Date: 10 Feb 2012 07:49:43
Message: <4f351267@news.povray.org>
Orchid Win7 v1 <voi### [at] devnull> wrote:
> And isn't it -rf actually? I seem to recall that otherwise it asks for 
> confirmation...

  The -f is just to force it to remove files that wouldn't be removed
otherwise (without that flag). This is a relatively rare circumstance,
but unix people write it nevertheless as a matter of course.

-- 
                                                          - Warp


Post a reply to this message

From: Alain
Subject: Re: Today's annoyance
Date: 10 Feb 2012 17:37:41
Message: <4f359c35@news.povray.org>

> nemesis<nam### [at] gmailcom>  wrote:
>> there actually is rmdir in Unix too.  And rm dir will only work with the -r
>> recursive switch.  Unless you simply use rmdir dir, that deletes dir and all.
>
>    Actually rmdir will remove a directory only if it's empty.
>

Way back to the DOS era, you had deltree that would suppress a directory 
and all it's content including any sub-directory.
I think, not sure, that it could be used without a following directory 
name, and would suppress the content of the current directory... Prety 
dangerous if isued from the root.

Also, in DOS, rd dir suppressed a given directory.



Alain


Post a reply to this message

From: Darren New
Subject: Re: Today's annoyance
Date: 10 Feb 2012 23:10:53
Message: <4f35ea4d$1@news.povray.org>
On 2/9/2012 6:23, Invisible wrote:
> rm folder1
> it deletes the specified folder. So far so good, eh?

No it doesn't.

> Oh, but that fails if the folder is not empty, so you must add /S. Oh, but
> that asks for confirmation, so you must add /Q as well.

Other than the confirmation, this is all identical to how unix works. "rm" 
doesn't delete directories on unix unless you add "-r".  Unix has an rmdir 
command.

> Short version: To delete an object, you must know whether it is a file or a
> folder. Thanks for that... :-P

Or you could run both commands.

-- 
Darren New, San Diego CA, USA (PST)
   People tell me I am the counter-example.


Post a reply to this message

From: Darren New
Subject: Re: Today's annoyance
Date: 10 Feb 2012 23:11:47
Message: <4f35ea83@news.povray.org>
On 2/10/2012 4:49, Warp wrote:
>    The -f is just to force it to remove files that wouldn't be removed

It also stops it from complaining if the file isn't there, fwiw.

-- 
Darren New, San Diego CA, USA (PST)
   People tell me I am the counter-example.


Post a reply to this message

From: Kevin Wampler
Subject: Re: Today's annoyance
Date: 11 Feb 2012 00:43:41
Message: <4f36000d$1@news.povray.org>
On 2/10/2012 8:11 PM, Darren New wrote:
> On 2/10/2012 4:49, Warp wrote:
>> The -f is just to force it to remove files that wouldn't be removed
>
> It also stops it from complaining if the file isn't there, fwiw.
>

This is I normally see it used.  Tangentially, this reminds me of the 
time I typed

rm * .txt

in my home directory.  Thank goodness I didn't add the -rf flag!


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.