Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Vista Newsgroups > Vista file management

Vista - "del /s foo*" doesn't work

Reply
 
Old 10-27-2006   #1 (permalink)
Roof Fiddler


 
 

"del /s foo*" doesn't work

What's the command-line command to recursively delete all files and
directories with names beginning with "foo"?
"del /s foo*" doesn't work.

Doing it using the GUI, with Start/Search and searching for "name:foo" and
then selecting all and choosing "delete", doesn't work, because I have
hundreds of such directories, and for each one Vista will grind away on my
disk for a couple minutes and then give me a bogus "This folder is shared
with other people--If you delete this folder, it will no longer be
shared.--Continue or Cancel" message and make me press "Continue" before it
will grind away for another couple minutes and give me another bogus message
for the next folder, and there's no "Yes to All" button, so I have to sit
for hours babysitting the machine and pressing "Continue" over and over in
order to delete all the directories.
So until MS fixes that bug, I need to do it from the command line.

So what's the command to do it?


My System SpecsSystem Spec
Old 10-28-2006   #2 (permalink)
DMB


 
 

Re: "del /s foo*" doesn't work

Did you try doing this while running the command prompt as Administrator?

-- Dave

"Roof Fiddler" <fiddler@roof.com> wrote in message
news:OAJ08Rc%23GHA.4704@TK2MSFTNGP04.phx.gbl...
> What's the command-line command to recursively delete all files and
> directories with names beginning with "foo"?
> "del /s foo*" doesn't work.
>
> Doing it using the GUI, with Start/Search and searching for "name:foo" and
> then selecting all and choosing "delete", doesn't work, because I have
> hundreds of such directories, and for each one Vista will grind away on my
> disk for a couple minutes and then give me a bogus "This folder is shared
> with other people--If you delete this folder, it will no longer be
> shared.--Continue or Cancel" message and make me press "Continue" before
> it will grind away for another couple minutes and give me another bogus
> message for the next folder, and there's no "Yes to All" button, so I have
> to sit for hours babysitting the machine and pressing "Continue" over and
> over in order to delete all the directories.
> So until MS fixes that bug, I need to do it from the command line.
>
> So what's the command to do it?
>


My System SpecsSystem Spec
Old 10-29-2006   #3 (permalink)
Roof Fiddler


 
 

Re: "del /s foo*" doesn't work

"DMB" <noemail@newsgroups.OK> wrote in message
news:u0gcU8n%23GHA.5092@TK2MSFTNGP04.phx.gbl...
> Did you try doing this while running the command prompt as Administrator?

That shouldn't be necessary, since the logged-in user owns the files and
folders in question.

My System SpecsSystem Spec
Old 10-29-2006   #4 (permalink)
Kerry Brown


 
 

Re: "del /s foo*" doesn't work

You're right it shouldn't be necessary but did you try it? Vista is still a
beta and may have bugs. Running an elevated cmd prompt is a valid test to
see if there are some permissions issues or maybe a bug.

--
Kerry
MS-MVP Windows - Shell/User
http://www.vistahelp.ca


Roof Fiddler wrote:
> "DMB" <noemail@newsgroups.OK> wrote in message
> news:u0gcU8n%23GHA.5092@TK2MSFTNGP04.phx.gbl...
>> Did you try doing this while running the command prompt as
>> Administrator?

> That shouldn't be necessary, since the logged-in user owns the files
> and folders in question.



My System SpecsSystem Spec
Old 10-29-2006   #5 (permalink)
Jimmy Brush


 
 

Re: "del /s foo*" doesn't work

I tried this on my system and it worked fine. Can you give more information
as to what files you are trying to delete and what response you are getting
from the command prompt?


--
- JB

Windows Vista Support Faq
http://www.jimmah.com/vista/

My System SpecsSystem Spec
Old 11-01-2006   #6 (permalink)
Roof Fiddler


 
 

Re: "del /s foo*" doesn't work

"Jimmy Brush" <JimmyBrush@discussions.microsoft.com> wrote in message
news:75B567B8-3A6C-44E2-9C9D-530A7F5D6096@microsoft.com...
>I tried this on my system and it worked fine. Can you give more information
>as to what files you are trying to delete and what response you are getting
>from the command prompt?


I open cmd.exe as administrator, and:

C:\Windows\system32>mkdir foo
C:\Windows\system32>mkdir foo\bar
C:\Windows\system32>mkdir foo\bar\baz

C:\Windows\system32>dir /s bar
[snip]
Directory of C:\Windows\system32\foo
11/01/2006 10:05 AM <DIR> bar
0 File(s) 0 bytes
[snip]
C:\Windows\system32>dir /s baz
[snip]
Directory of C:\Windows\system32\foo\bar
11/01/2006 10:06 AM <DIR> baz
0 File(s) 0 bytes
[snip]

C:\Windows\system32>del /s bar

C:\Windows\system32>dir /s bar
[snip]
Directory of C:\Windows\system32\foo
11/01/2006 10:05 AM <DIR> bar
0 File(s) 0 bytes
[snip]
C:\Windows\system32>
C:\Windows\system32>dir /s baz
[snip]
Directory of C:\Windows\system32\foo\bar
11/01/2006 10:06 AM <DIR> baz
0 File(s) 0 bytes
[snip]

So, even though "del /s bar" returns no error message, neither bar nor its
contents (baz) are actually deleted.
Yes, I know how to actually get rid of bar and baz in this case. The problem
is that I might have many directories named "bar" scattered throughout
various other subdirectories of my current directory, and I need a single
command which, when run from my current directory, will delete all of them
and their contents.

My System SpecsSystem Spec
Old 12-27-2006   #7 (permalink)
Eddie The 'Ead


 
 

Re: "del /s foo*" doesn't work



"Roof Fiddler" wrote:

> So, even though "del /s bar" returns no error message, neither bar nor its
> contents (baz) are actually deleted.


This is driving me crazy too. I have the exact same problem in both Vista
AND XP and really need an answer from someone smarter than me...
What's most frustrating is that the del command help states "Wildcards may
be used to delete multiple files. If a directory is specified, all files
within the directory will be deleted." But it simply doesn't happen.

The best I have come up with so far is to copy DELTREE command into the
system and use the following batch file to creates a list of the directories
you want to delete:

cd %1
dir /s BAR /a /b /-p /o:GEN >"C:\Documents and Settings\%USERNAME%\Local
Settings\Temp\dirlist.txt"
copy "C:\Documents and Settings\%USERNAME%\Local Settings\Temp\dirlist.txt" %1
del "C:\Documents and Settings\%USERNAME%\Local Settings\Temp\dirlist.txt"

and then turn that "dirlist.txt" into a .bat file with the 'deltree' command
in front of each line in quotes. Run it and voila!
(Very oldschool, but at least it works.)
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
SOLVED! "Cannot load Contacts" "0x8004104E" "MSOE.DLL" Vista mail
Unwanted Multiple contacts in "To","CC","BCC" of email send catago Vista mail
Vista not wotking with "My Computer" or "Control Panel", "Screen Saver" Vista General
How can I add the icons "Delete", "Cut", "Copy" and "Paste" in Vis Vista file management
WM5 Sync with Vista "Windows Calender", "Contacts", and "Mail" Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46