Windows batch command for deleting particular pattern named folders in temp


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Old 3 Weeks Ago
Windows batch command for deleting particular pattern named folders in temp

Hi All,'

I need to write a windows bat program to delete particular folders with naming pattern scoped_dir45666 (for example)(including contents)
with batch program. For that I am using below code:
Code:
@echo off
cd /D %temp%
for /d %%D in (*) do rd /s /q "%%D"
del /f /q *

i got above code from some forum, but its deleting everything causing system issues...(its screwing some os files also I guess)

I need to delete all directories names starting with scoped_dirxxxxx (scoped_dir*) can some one advise how to modify above code to delete only folders name starting with scoped_dir in %temp% folder




Moderator's Comments:
Mod Comment Please use CODE (not ICODE) tags as required by forum rules!

Last edited by joeyg; 2 Weeks Ago at 11:04 AM..
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Windows Batch to Bash xgringo UNIX for Beginners Questions & Answers 3 4 Weeks Ago 08:23 PM
Windows Batch script for Unix commands mohtashims Shell Programming and Scripting 7 10-16-2012 04:52 AM
How to start a vbs from a windows batch file? Grueben Windows & DOS: Issues & Discussions 1 01-10-2012 05:30 AM
Batch rename files that do not match pattern atulkakrana Shell Programming and Scripting 3 11-30-2011 06:57 AM
Gawk Script in Windows batch file - Help 10000springs Windows & DOS: Issues & Discussions 6 01-12-2011 02:16 PM
Batch rename files after internal search pattern aavv Shell Programming and Scripting 2 09-13-2010 07:11 PM
Recursive Replication of Unix folders to Windows mlv_99 Shell Programming and Scripting 5 04-17-2010 06:22 PM
Check the file size using Batch script in windows krackjack Windows & DOS: Issues & Discussions 0 02-03-2010 07:36 AM
Remove lines from batch of files which match pattern talktobog Shell Programming and Scripting 3 12-02-2009 05:11 PM
Copy folders and subfolders from unix to windows chssastry Windows & DOS: Issues & Discussions 3 12-17-2008 07:31 AM
Executing Windows batch file from UNIX flip387 Shell Programming and Scripting 5 10-24-2008 11:57 AM
Windows services for unix - How do I run in batch rbdenham Windows & DOS: Issues & Discussions 3 06-05-2008 03:42 PM
backup through batch file in windows arulkumar UNIX for Dummies Questions & Answers 0 06-04-2008 05:10 AM
windows scripting for a batch job MizzGail Windows & DOS: Issues & Discussions 2 03-30-2007 06:42 PM
How can I run scripts in my unix account from batch file in Windows? olgafb UNIX for Dummies Questions & Answers 7 05-27-2006 09:40 AM