Deleting Directories with BAT File

G

Guest

Guest
Archived from groups: microsoft.public.win2000.file_system (More info?)

Anyone have the command line switches for deleting a
directory under C:\Program Files? I have tried using the
del "directory name" function but that isn't working.
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.file_system (More info?)

depends...
on windows 95/98 use deltree
on NT+ and older... use rmdir /q /s

the problem is.........
there is always something in c:\program files that is in use and therefore
locked...
nice try!!!

"Tim Pafford" <tpafford@ssrm.com> wrote in message
news:77a601c43126$a5de3ce0$a401280a@phx.gbl...
> Anyone have the command line switches for deleting a
> directory under C:\Program Files? I have tried using the
> del "directory name" function but that isn't working.
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.file_system (More info?)

>-----Original Message-----
>Anyone have the command line switches for deleting a
>directory under C:\Program Files? I have tried using
the
>del "directory name" function but that isn't working.
>.
>have you tried deltree? be careful, it deletes
everything that is in the downline directory. For
instance, deltree c:\windows\program files\quicken would
delete everything under the quicken directory. Good Luck!
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.file_system (More info?)

andrea catto' wrote:

> depends...
> on windows 95/98 use deltree
> on NT+ and older... use rmdir /q /s
>
> the problem is.........
> there is always something in c:\program files that is in use and therefore
> locked...
> nice try!!!
>
> "Tim Pafford" <tpafford@ssrm.com> wrote in message
> news:77a601c43126$a5de3ce0$a401280a@phx.gbl...
>
>>Anyone have the command line switches for deleting a
>>directory under C:\Program Files? I have tried using the
>>del "directory name" function but that isn't working.
>
>
>
I am not sure what you are trying to do. Obviously, while Windows is
running, files will be in use in some directories of \program files.
Deleting them would create problems with Windows, may be disable it. But
if this does not matter because you want to uninstall Windows for
instance, then booting from a Win98 startup diskette and using deltree
will do the job. But first check the diskette to make sure deltree is on
it, I kind of think it is not part of the startup utilities. You would
then have to copy deltree on the harddisk before.

I know some utilities allows to program the deletion of files that are
in use (they get deleted after a reboot). I believe one is called
delaydelete. If you cannot find one, I can email it to you but I have no
experience using it.

--
John Doue
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.file_system (More info?)

anonymous@discussions.microsoft.com wrote:

>>have you tried deltree? be careful, it deletes
> everything that is in the downline directory. For
> instance, deltree c:\windows\program files\quicken would
> delete everything under the quicken directory. Good Luck!

There's no deltree in Windows 2000. The equivalent command is RD /s.

--
Gary L. Smith gls432@yahoo.com
Columbus, Ohio
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.file_system (More info?)

Hi, Tim.

The del command deletes FILES, but it never was the command to delete
directories (or folders). In MS-DOS, we used rmdir or rd to Remove
Directory.

In the "DOS" window of Win2K/XP, or on the Command line, we still use rd
<directory>. As with any "DOS" command, we can type rd /? and see a
mini-Help file showing all the switches available for the command. There
are only two switches for rd: /q and /s. The /s switch removes the entire
directory tree, including all subdirectories and all files within them; it
asks "are you sure?" before deleting. The /q switch invokes the Quiet mode,
which removes everything without asking.

So, if you are sure you want to remove the entire directory tree and you
know the name of the directory at the top of the tree, just put one short
line in your batch file (for C:\Program Files\Fubar, for instance):

rd "c:\program files\fubar" /s /q

(The quotes, of course, are needed because of the space in "Program Files".)

RC
--
R. C. White, CPA
San Marcos, TX
rc@corridor.net
Microsoft Windows MVP

"Tim Pafford" <tpafford@ssrm.com> wrote in message
news:77a601c43126$a5de3ce0$a401280a@phx.gbl...
> Anyone have the command line switches for deleting a
> directory under C:\Program Files? I have tried using the
> del "directory name" function but that isn't working.
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.file_system (More info?)

R. C. White wrote:
> Hi, Tim.
>
> The del command deletes FILES, but it never was the command to delete
> directories (or folders). In MS-DOS, we used rmdir or rd to Remove
> Directory.
>
> In the "DOS" window of Win2K/XP, or on the Command line, we still use rd
> <directory>. As with any "DOS" command, we can type rd /? and see a
> mini-Help file showing all the switches available for the command.
> There are only two switches for rd: /q and /s. The /s switch removes
> the entire directory tree, including all subdirectories and all files
> within them; it asks "are you sure?" before deleting. The /q switch
> invokes the Quiet mode, which removes everything without asking.
>
> So, if you are sure you want to remove the entire directory tree and you
> know the name of the directory at the top of the tree, just put one
> short line in your batch file (for C:\Program Files\Fubar, for instance):
>
> rd "c:\program files\fubar" /s /q
>
> (The quotes, of course, are needed because of the space in "Program
> Files".)
>
> RC
I believe you missed a crucial point from Tim's question: how to delete
files which are in use. I hope I addressed that point in my previous
post but we have not heard from Tim anymore.

--
John Doue
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.file_system (More info?)

Thank you to all of you for your suggestions.

Since I am running this in a Win2K environment, I am going
with rd "C:\Program Files\directory name" /s /q. Seems to
work like a champ.

Thanks again for all of the ideas. These will definetly
come in handy in the future.


>-----Original Message-----
>R. C. White wrote:
>> Hi, Tim.
>>
>> The del command deletes FILES, but it never was the
command to delete
>> directories (or folders). In MS-DOS, we used rmdir or
rd to Remove
>> Directory.
>>
>> In the "DOS" window of Win2K/XP, or on the Command
line, we still use rd
>> <directory>. As with any "DOS" command, we can type
rd /? and see a
>> mini-Help file showing all the switches available for
the command.
>> There are only two switches for rd: /q and /s. The /s
switch removes
>> the entire directory tree, including all subdirectories
and all files
>> within them; it asks "are you sure?" before deleting.
The /q switch
>> invokes the Quiet mode, which removes everything
without asking.
>>
>> So, if you are sure you want to remove the entire
directory tree and you
>> know the name of the directory at the top of the tree,
just put one
>> short line in your batch file (for C:\Program
Files\Fubar, for instance):
>>
>> rd "c:\program files\fubar" /s /q
>>
>> (The quotes, of course, are needed because of the space
in "Program
>> Files".)
>>
>> RC
>I believe you missed a crucial point from Tim's question:
how to delete
>files which are in use. I hope I addressed that point in
my previous
>post but we have not heard from Tim anymore.
>
>--
>John Doue
>.
>
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.file_system (More info?)

Good catch, John.

But Tim has reported success, so I guess it worked out OK. Maybe there were
no in-use files in that particular directory. ;<)

RC
--
R. C. White, CPA
San Marcos, TX
rc@corridor.net
Microsoft Windows MVP

"John Doue" <notwobe@yahoo.com> wrote in message
news:uE6T2jdMEHA.3872@TK2MSFTNGP12.phx.gbl...
> R. C. White wrote:
>> Hi, Tim.
>>
>> The del command deletes FILES, but it never was the command to delete
>> directories (or folders). In MS-DOS, we used rmdir or rd to Remove
>> Directory.
>>
>> In the "DOS" window of Win2K/XP, or on the Command line, we still use rd
>> <directory>. As with any "DOS" command, we can type rd /? and see a
>> mini-Help file showing all the switches available for the command. There
>> are only two switches for rd: /q and /s. The /s switch removes the
>> entire directory tree, including all subdirectories and all files within
>> them; it asks "are you sure?" before deleting. The /q switch invokes the
>> Quiet mode, which removes everything without asking.
>>
>> So, if you are sure you want to remove the entire directory tree and you
>> know the name of the directory at the top of the tree, just put one short
>> line in your batch file (for C:\Program Files\Fubar, for instance):
>>
>> rd "c:\program files\fubar" /s /q
>>
>> (The quotes, of course, are needed because of the space in "Program
>> Files".)
>>
>> RC
> I believe you missed a crucial point from Tim's question: how to delete
> files which are in use. I hope I addressed that point in my previous post
> but we have not heard from Tim anymore.
>
> --
> John Doue