How to empty a folder tree?

G

Guest

It would be useful to me learning how I can delete files from some base
folder including all its subfolders, but keeping the folder structure, so I
dont have to recreate them every time I backup and cleanup.

Every other method, I cant think of, to achieve the goal is fine to me as
well, of course.

thank you
ric
 
J

John John

From the Command Prompt navigate to the first directory in the tree and
issue:

del *.* /s /q

Be certain that you are in the right directory! It will erase all the
files from the directory in which the command was issued on down! The
files will be permanently deleted, del does not use the Recycle Bin!

John
 
P

Poprivet

John said:
From the Command Prompt navigate to the first directory in the tree
and issue:

del *.* /s /q

Be certain that you are in the right directory! It will erase all the
files from the directory in which the command was issued on down! The
files will be permanently deleted, del does not use the Recycle Bin!

John

In XP Pro you don't need either of the switches. Just del *.* in the
highest level directory will do it. It surprised me, but it worked, and of
course left all the subdirectories in place. The switches don't hurt
anything, of course.
I don't care for /Q personally, because I like the 'Are you Sure'
reminder message.

HTH
Pop`
 
J

John John

Poprivet said:
In XP Pro you don't need either of the switches. Just del *.* in the
highest level directory will do it. It surprised me, but it worked, and of
course left all the subdirectories in place. The switches don't hurt
anything, of course.
I don't care for /Q personally, because I like the 'Are you Sure'
reminder message.

I find it surprising that on your XP Pro del *.* without any switches
would erase files in subfolders! The expected results of the command is
that it erases all the files in the current directory only. It would
also surprise me that this would be specific to XP Pro but not XP Home.
I wonder if any other users here are seeing the same behaviour with
the command. I can't verify right now but maybe other users could give
us their results. It seems to me it would be a bug if it behaves that way!

John
 
G

Guest

Oh Thanks John, it worked fine!
Also, in my xp pro there is no bug: the switch is needed.
I'd also keep the /q switch, it's safer and prevents from hurrying too much...
Regards,
Ricardo
 
G

Guest

SingaporeWebDesign said:
Hello,

Perform an empty search on the folder, sort by type (folders will go to
top), select all the files by selecting the first file item and then hitting
shift-end to select, hit delete.

Nice method, unless the number of files is too large...I dont like to wait
for hard drive scanning and select 10.000 files or more...beside that I'll
keep it in mind, good trick.
Thank you so much. Bye,
Ricardo
 
P

Poprivet

John said:
....

I find it surprising that on your XP Pro del *.* without any
switches would erase files in subfolders! The expected results of
the command is that it erases all the files in the current directory
only. It would also surprise me that this would be specific to XP Pro but
not XP
Home. I wonder if any other users here are seeing the same behaviour
with the command. I can't verify right now but maybe other users could
give us their results. It seems to me it would be a bug if it behaves
that way!
John

You're right, of course! My bad, and a big blunder at that!
It happened as I said it did, but ... because I had set the environment
variables! So, I CAN reproduce it, but ... only by setting those same
variables again. My bad!

Actually I'm kicking myself for being so stupid because I work at the
Command Prompt all the time and obviously wasn't paying attention because I
know better!! Won't happen again; I hope!!!
So much for "proofing" it before I posted.

Regards,

Pop`
 
J

John John

ricardo.l said:
:




Oh Thanks John, it worked fine!
Also, in my xp pro there is no bug: the switch is needed.
I'd also keep the /q switch, it's safer and prevents from hurrying too much...

You're welcome. Thanks fo the follow up.

John
 
J

John John

Poprivet said:
You're right, of course! My bad, and a big blunder at that!
It happened as I said it did, but ... because I had set the environment
variables! So, I CAN reproduce it, but ... only by setting those same
variables again. My bad!

Actually I'm kicking myself for being so stupid because I work at the
Command Prompt all the time and obviously wasn't paying attention because I
know better!! Won't happen again; I hope!!!
So much for "proofing" it before I posted.

I kind of thought that something wasn't right, I thought for sure that
something was wrong with your XP installation.

John
 

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