PC Review


Reply
Thread Tools Rate Thread

delete folders with wildcards

 
 
Vijay
Guest
Posts: n/a
 
      30th Sep 2009
I want to remove folders which starts with "s" characters , i want to use
wildcards to remove folders, , Please tll me which command i should use in
command prompt. i am using winxp sp2. folder location is c:\ (c drive) ,
 
Reply With Quote
 
 
 
 
Elmo
Guest
Posts: n/a
 
      30th Sep 2009
Vijay wrote:
> I want to remove folders which start with "s" characters; I want to use
> wildcards to remove folders. Please tell me which command I should use in
> command prompt. I am using XP sp2. Folder location is c:\ (c drive)


Type in RMDIR /? to see the required syntax. To remove those pesky
folders, such as "System Volume Information" from the C:\ root folder,
consider this command:

RMDIR S*

Have your XP install CD and all backups nearby, of course.. there is no
Undelete command in XP.

--
Joe =o)
 
Reply With Quote
 
Vijay
Guest
Posts: n/a
 
      30th Sep 2009
RMDIR S*

option is not working , i think , RMDIR command does not support wildcards,

Please help me to search the answer,


"Elmo" wrote:

> Vijay wrote:
> > I want to remove folders which start with "s" characters; I want to use
> > wildcards to remove folders. Please tell me which command I should use in
> > command prompt. I am using XP sp2. Folder location is c:\ (c drive)

>
> Type in RMDIR /? to see the required syntax. To remove those pesky
> folders, such as "System Volume Information" from the C:\ root folder,
> consider this command:
>
> RMDIR S*
>
> Have your XP install CD and all backups nearby, of course.. there is no
> Undelete command in XP.
>
> --
> Joe =o)
>

 
Reply With Quote
 
Bob I
Guest
Posts: n/a
 
      30th Sep 2009
You could use Windows Search For File and Folders, it accepts Wildcards
( find S* ) when it is done , Click File to sort them so the Folders are
at the Top, Select them all and then delete them.

Vijay wrote:

> RMDIR S*
>
> option is not working , i think , RMDIR command does not support wildcards,
>
> Please help me to search the answer,
>
>
> "Elmo" wrote:
>
>
>>Vijay wrote:
>>
>>>I want to remove folders which start with "s" characters; I want to use
>>>wildcards to remove folders. Please tell me which command I should use in
>>>command prompt. I am using XP sp2. Folder location is c:\ (c drive)

>>
>>Type in RMDIR /? to see the required syntax. To remove those pesky
>>folders, such as "System Volume Information" from the C:\ root folder,
>>consider this command:
>>
>>RMDIR S*
>>
>>Have your XP install CD and all backups nearby, of course.. there is no
>>Undelete command in XP.
>>
>>--
>>Joe =o)
>>


 
Reply With Quote
 
Vijay
Guest
Posts: n/a
 
      30th Sep 2009
I want to delete folders with command prompt, when i run command , it should
be automatically deleted.

location of the folder my be different,

"Bob I" wrote:

> You could use Windows Search For File and Folders, it accepts Wildcards
> ( find S* ) when it is done , Click File to sort them so the Folders are
> at the Top, Select them all and then delete them.
>
> Vijay wrote:
>
> > RMDIR S*
> >
> > option is not working , i think , RMDIR command does not support wildcards,
> >
> > Please help me to search the answer,
> >
> >
> > "Elmo" wrote:
> >
> >
> >>Vijay wrote:
> >>
> >>>I want to remove folders which start with "s" characters; I want to use
> >>>wildcards to remove folders. Please tell me which command I should use in
> >>>command prompt. I am using XP sp2. Folder location is c:\ (c drive)
> >>
> >>Type in RMDIR /? to see the required syntax. To remove those pesky
> >>folders, such as "System Volume Information" from the C:\ root folder,
> >>consider this command:
> >>
> >>RMDIR S*
> >>
> >>Have your XP install CD and all backups nearby, of course.. there is no
> >>Undelete command in XP.
> >>
> >>--
> >>Joe =o)
> >>

>
>

 
Reply With Quote
 
John John - MVP
Guest
Posts: n/a
 
      30th Sep 2009

The problem with that is that if you try to delete using S* wildcard you
will or may have serious problems! For example, searching for S* will
find folders like the System, System32, ServicePackFiles, and System
Volume Information folders, to name only a few. Just run the following
command and you will see what I mean:

dir c:\s* /ad /s/b

You could always run the above command and send the output to a text
file then weed out the file and then run a batch file that uses the FOR
command with your input file to delete the folders.

John

Vijay wrote:
> I want to delete folders with command prompt, when i run command , it should
> be automatically deleted.
>
> location of the folder my be different,
>
> "Bob I" wrote:
>
>> You could use Windows Search For File and Folders, it accepts Wildcards
>> ( find S* ) when it is done , Click File to sort them so the Folders are
>> at the Top, Select them all and then delete them.
>>
>> Vijay wrote:
>>
>>> RMDIR S*
>>>
>>> option is not working , i think , RMDIR command does not support wildcards,
>>>
>>> Please help me to search the answer,
>>>
>>>
>>> "Elmo" wrote:
>>>
>>>
>>>> Vijay wrote:
>>>>
>>>>> I want to remove folders which start with "s" characters; I want to use
>>>>> wildcards to remove folders. Please tell me which command I should use in
>>>>> command prompt. I am using XP sp2. Folder location is c:\ (c drive)
>>>> Type in RMDIR /? to see the required syntax. To remove those pesky
>>>> folders, such as "System Volume Information" from the C:\ root folder,
>>>> consider this command:
>>>>
>>>> RMDIR S*
>>>>
>>>> Have your XP install CD and all backups nearby, of course.. there is no
>>>> Undelete command in XP.
>>>>
>>>> --
>>>> Joe =o)
>>>>

>>

 
Reply With Quote
 
Twayne
Guest
Posts: n/a
 
      30th Sep 2009
"John John - MVP" <(E-Mail Removed)> wrote in message
news:%23YY3$(E-Mail Removed)
> The problem with that is that if you try to delete using S* wildcard
> you will or may have serious problems! For example, searching for S*
> will find folders like the System, System32, ServicePackFiles, and
> System Volume Information folders, to name only a few. Just run the
> following command and you will see what I mean:
>
> dir c:\s* /ad /s/b
>
> You could always run the above command and send the output to a text
> file then weed out the file and then run a batch file that uses the
> FOR command with your input file to delete the folders.
>
> John
>
> Vijay wrote:
>> I want to delete folders with command prompt, when i run command ,
>> it should be automatically deleted.
>>
>> location of the folder my be different,
>>
>> "Bob I" wrote:
>>
>>> You could use Windows Search For File and Folders, it accepts
>>> Wildcards ( find S* ) when it is done , Click File to sort them so
>>> the Folders are at the Top, Select them all and then delete them.
>>>
>>> Vijay wrote:
>>>
>>>> RMDIR S*
>>>>
>>>> option is not working , i think , RMDIR command does not support
>>>> wildcards, Please help me to search the answer,
>>>>
>>>>
>>>> "Elmo" wrote:
>>>>
>>>>
>>>>> Vijay wrote:
>>>>>
>>>>>> I want to remove folders which start with "s" characters; I want
>>>>>> to use wildcards to remove folders. Please tell me which
>>>>>> command I should use in command prompt. I am using XP sp2.
>>>>>> Folder location is c:\ (c drive)
>>>>> Type in RMDIR /? to see the required syntax. To remove those
>>>>> pesky folders, such as "System Volume Information" from the C:\
>>>>> root folder, consider this command:
>>>>>
>>>>> RMDIR S*
>>>>>
>>>>> Have your XP install CD and all backups nearby, of course.. there
>>>>> is no Undelete command in XP.
>>>>>
>>>>> --
>>>>> Joe =o)


Right. Without using a starting path, it could be pretty disastrous:
rmdir /? gives:

Removes (deletes) a directory.

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

/S Removes all directories
in addition to the dire
ctory tree.

/Q Quiet mode, do not ask

C:\Documents and Settings\T Wayne>


 
Reply With Quote
 
Pegasus [MVP]
Guest
Posts: n/a
 
      30th Sep 2009


"Vijay" <(E-Mail Removed)> wrote in message
news:B507EC90-F7F3-4510-9BD6-(E-Mail Removed)...
>I want to delete folders with command prompt, when i run command , it
>should
> be automatically deleted.
>
> location of the folder my be different,
>


As others have said, deleting folders with wildcards is dangerous business.
If you're prepared to wear the risk, here is how you can do it:
1. Copy and paste the code below into c:\Windows\DelFolder.bat.
2. Unwrap wrapped lines.
3. Make Line 3 like so: set Active=No
4. Remove the line numbers.
5. Save the file.
6. To delete all folders starting with "abc", invoke the batch file like so:
DelFolder c:\documents and settings\Vijay\abc
Do *not* write it like so:
DelFolder c:\documents and settings\Vijay\abc*
7. If you are happy with the result, set Active=Yes in Line 3. You will
be asked for a confirmation before the folder is deleted. No folder
will be deleted just yet.
8. If you are prepared to wear the risk, set Active=Rip in Line 3. You
will *not* be asked for any confirmation. No folder will be deleted
just yet.
9. If you are happy with Steps 8 and 9, remove the words "echo" in
Lines 21 and 25. The batch file will now be fully active.
Note: You run this batch file at your own risk.

[01] @echo off
[02] rem Possible values for Active: No, Yes, Rip
[03] set Active=Rip
[04] if "%*"=="" (
[05] echo Missing folder specicfication.
[06] pause
[07] goto :eof
[08] )
[09] for %%a in ("%*") do set Folder=%%~dpa
[10] for /F "delims=" %%a in ('dir /s /b /ad "%Folder%" ^| find /i "%*"') do
call :Sub %%a
[11] goto :eof
[12]
[13] :Sub
[14] if /i %Active%==Yes goto Yes
[15] if /i %Active%==Rip goto Rip
[16] echo Folder=%*
[17] goto :eof
[18]
[19] :Yes
[20] set /p confirm=Delete "%*%? (Y/N)
[21] if /i "%confirm%"=="Y" echo rd /s /q "%*"
[22] goto :eof
[23]
[24] :Rip
[25] echo rd /s /q "%*"


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Wildcards for Folders Orion Cochrane Microsoft Excel Programming 5 28th Aug 2008 02:06 PM
Hide/Delete Deleted Items & Search Folders Folders in Outlook 2003 =?Utf-8?B?anBzcHJpbmdhbGw=?= Microsoft Outlook VBA Programming 1 24th Apr 2006 02:51 PM
xCopy Folders using wildcards jd Windows XP General 2 22nd Jan 2005 04:21 PM
Outlook 2002 Delete Empty Folders from Personal Folders Greg Hadlock Microsoft Outlook Program Addins 0 29th Jul 2003 03:17 PM
Search companion - no wildcards for folders Bill Windows XP General 1 16th Jul 2003 09:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:35 PM.