|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> 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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |