Windows Vista Forums

"del /s foo*" doesn't work

  1. #1


    Roof Fiddler Guest

    "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

  2. #2


    DMB Guest

    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

  3. #3


    Roof Fiddler Guest

    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

  4. #4


    Kerry Brown Guest

    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

  5. #5


    Jimmy Brush Guest

    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

  6. #6


    Roof Fiddler Guest

    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

  7. #7


    Eddie The 'Ead Guest

    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

"del /s foo*" doesn't work

Similar Threads
Thread Thread Starter Forum Replies Last Post
Kaplan Software Doesn't Work - Receive "MCI Driver not loaded" err mikeynavy1 Vista General 8 02 Jan 2010
WinSAT "View and print details" Link Doesn't Work Pat Vista performance & maintenance 0 10 Aug 2008
Wirless Network Doesn't work after "hibernation or sleep" mode sailorsxe Vista networking & sharing 3 19 Aug 2007
"Disable Visual Themes" option doesn't work in app properties. Yannek Vista General 0 28 Apr 2007
"Snap-To" mouse action doesn't work in dialog boxes M Stanley Vista mail 4 12 Dec 2006