Using the DEL command

G

Guest

Hi, i am using the DEL command, and i am trying to delete all the files in a
certain folder.

The command did work, but it did NOT delete the folders within that
particular folder.

I did specify /TEMP/*.* ETC. So how do i delete the folder within the folder?

Can anyone help.

regards
 
M

Mikhail Zhilin

Use:

del /s c:\TEMP\*.*

(/s switch means: "including Subfolders"). Note that in the path you
have to use backslashes, while with the switch -- forward slash.
--
Mikhail Zhilin
http://www.aha.ru/~mwz
Sorry, no technical support by e-mail.
Please reply to the newsgroups only.
======
 
T

Terry

On 12/31/2004 4:19 PM On a whim, Mikhail Zhilin pounded out on the keyboard
Use:

del /s c:\TEMP\*.*

(/s switch means: "including Subfolders"). Note that in the path you
have to use backslashes, while with the switch -- forward slash.
--
Mikhail Zhilin
http://www.aha.ru/~mwz
Sorry, no technical support by e-mail.
Please reply to the newsgroups only.
======

That will not remove the subfolders, only the files within the
subfolders. There isn't an equivalent to DELTREE. Using rmdir removes
the parent folder also which then needs to be re-created.


--
Terry

***Reply Note***
Anti-spam measures are included in my email address.
Delete NOSPAM from the email address after clicking Reply.
 
A

Alex Nichol

Pinto1uk said:
Hi, i am using the DEL command, and i am trying to delete all the files in a
certain folder.

The command did work, but it did NOT delete the folders within that
particular folder.

Use the /S switch to delete sub-folders and their contents as well
 
T

Terry

Hi, i am using the DEL command, and i am trying to delete all the files in a
certain folder.

The command did work, but it did NOT delete the folders within that
particular folder.


Use the /S switch to delete sub-folders and their contents as well
[/QUOTE]

Using /S unfortunately does not remove the sub-folders, only the files
within the sub-folders.

--
Terry

***Reply Note***
Anti-spam measures are included in my email address.
Delete NOSPAM from the email address after clicking Reply.
 
T

Troll

Terry said:
Use the /S switch to delete sub-folders and their contents as well

Using /S unfortunately does not remove the sub-folders, only the files
within the sub-folders.
[/QUOTE]

Try this:

RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path

/S Removes all directories and files in the specified directory
in addition to the directory itself. Used to remove a
directory
tree.

/Q Quiet mode, do not ask if ok to remove a directory tree with /S
 
M

Mikhail Zhilin

Terry wrote:
Using /S unfortunately does not remove the sub-folders, only the files
within the sub-folders.

Try this:

RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path
<...>

Unfortunately, RD command, unlike DEL, can't use wildcards -- and you
have to use the exact name of the folder you want to delete.

So if you want to delete all the nested folders with the names, which
are unknown a priori -- you have to delete the parent folder, and then
re-create it, like Terry said already (and -- yes, Terry, I see my
mistake now: with DEL /Q /S recommendation).

But re-creation of the parent folder may change its owner, and probably
the users rights -- what is inadmissible sometimes.

It could be possible to copy and use Deltree.exe from Win98, were it a
legitimate operation from the standpoint of the license agreement.
--
Mikhail Zhilin
http://www.aha.ru/~mwz
Sorry, no technical support by e-mail.
Please reply to the newsgroups only.
======
 
M

Mikhail Zhilin

Huh... To add to my reply to Troll...

It is the specific case, that is asked in the original message:
"Temporary Internet Files" folder.

T...I...F... folder of current user contains the undeletable file
index.dat (it is in use by Explorer). So I supposed that if to do
RD "Temporary Internet Files" folder -- that will delete all files and
folders in it except index.dat in "Content.IE5" folder. What will not
allow folders "Temporary Internet Files" and "Content.IE5" to be
deleted. And actually, command:

RD /S /Q "C:\Documents and Settings\Mikhail\Local Settings\Temporary
Internet Files"

causes an error message:

C:\Documents and Settings\Mikhail\Local Settings\Temporary Internet
Files\Content.IE5\index.dat - The process cannot access the file because
it is being used by another process.

while all other files and subfolders are deleting. Files "desktop.ini"
in "Temporary Internet Files" and "Content.IE5" folders will be
re-created during the first run of IE.
--
Mikhail Zhilin
http://www.aha.ru/~mwz
Sorry, no technical support by e-mail.
Please reply to the newsgroups only.
======
Use the /S switch to delete sub-folders and their contents as well

Using /S unfortunately does not remove the sub-folders, only the files
within the sub-folders.[/QUOTE]
 
T

Troll

Mikhail said:
Huh... To add to my reply to Troll...

It is the specific case, that is asked in the original message:
"Temporary Internet Files" folder.

T...I...F... folder of current user contains the undeletable file
index.dat (it is in use by Explorer). So I supposed that if to do
RD "Temporary Internet Files" folder -- that will delete all files and
folders in it except index.dat in "Content.IE5" folder. What will not
allow folders "Temporary Internet Files" and "Content.IE5" to be
deleted. And actually, command:

RD /S /Q "C:\Documents and Settings\Mikhail\Local Settings\Temporary
Internet Files"

causes an error message:

C:\Documents and Settings\Mikhail\Local Settings\Temporary Internet
Files\Content.IE5\index.dat - The process cannot access the file because
it is being used by another process.

while all other files and subfolders are deleting. Files "desktop.ini"
in "Temporary Internet Files" and "Content.IE5" folders will be
re-created during the first run of IE.
--
Mikhail Zhilin
http://www.aha.ru/~mwz
Sorry, no technical support by e-mail.
Please reply to the newsgroups only.
======

I must have come into the thread late. Didn't know it was a system
folder we were talking about.
 
T

Terry

On 1/1/2005 4:26 AM On a whim, Alex Nichol pounded out on the keyboard



Using /S unfortunately does not remove the sub-folders, only the files
within the sub-folders.


Try this:

RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path

/S Removes all directories and files in the specified directory
in addition to the directory itself. Used to remove a
directory
tree.

/Q Quiet mode, do not ask if ok to remove a directory tree with /S[/QUOTE]

That removes the top level folder along with the sub-folders, which is
not desired. Using rmdir /s /q c:\temp will remove all sub-folders under
temp and ALSO remove the temp folder. You then have to re-create the folder.


--
Terry

***Reply Note***
Anti-spam measures are included in my email address.
Delete NOSPAM from the email address after clicking Reply.
 
T

Terry

On 1/1/2005 1:10 PM On a whim, Mikhail Zhilin pounded out on the keyboard
Huh... To add to my reply to Troll...

It is the specific case, that is asked in the original message:
"Temporary Internet Files" folder.

T...I...F... folder of current user contains the undeletable file
index.dat (it is in use by Explorer). So I supposed that if to do
RD "Temporary Internet Files" folder -- that will delete all files and
folders in it except index.dat in "Content.IE5" folder. What will not
allow folders "Temporary Internet Files" and "Content.IE5" to be
deleted. And actually, command:

RD /S /Q "C:\Documents and Settings\Mikhail\Local Settings\Temporary
Internet Files"

causes an error message:

C:\Documents and Settings\Mikhail\Local Settings\Temporary Internet
Files\Content.IE5\index.dat - The process cannot access the file because
it is being used by another process.

while all other files and subfolders are deleting. Files "desktop.ini"
in "Temporary Internet Files" and "Content.IE5" folders will be
re-created during the first run of IE.
--
Mikhail Zhilin
http://www.aha.ru/~mwz
Sorry, no technical support by e-mail.
Please reply to the newsgroups only.
======

I think you may have confused the thread with one of the other similar
ones. This one never mentioned TIF;
<quote>
Hi, i am using the DEL command, and i am trying to delete all the files
in a certain folder.

The command did work, but it did NOT delete the folders within that
particular folder.

I did specify /TEMP/*.* ETC. So how do i delete the folder within the
folder?
</quote>

--
Terry

***Reply Note***
Anti-spam measures are included in my email address.
Delete NOSPAM from the email address after clicking Reply.
 
M

Mikhail Zhilin

Yes, sorry, you are correct: I became entangled in all these
"Pinto1uk"'s similar threads... :(
--
Mikhail Zhilin
http://www.aha.ru/~mwz
Sorry, no technical support by e-mail.
Please reply to the newsgroups only.
======
 
T

Terry

On 1/2/2005 2:01 AM On a whim, Mikhail Zhilin pounded out on the keyboard
Yes, sorry, you are correct: I became entangled in all these
"Pinto1uk"'s similar threads... :(
--
Mikhail Zhilin
http://www.aha.ru/~mwz
Sorry, no technical support by e-mail.
Please reply to the newsgroups only.
======

And they all are basically asking the same thing :-(

--
Terry

***Reply Note***
Anti-spam measures are included in my email address.
Delete NOSPAM from the email address after clicking Reply.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top