Computing.Net > Forums > Programming > Batch file to remove directories

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch file to remove directories

Reply to Message Icon

Name: ron5001
Date: July 15, 2005 at 09:12:00 Pacific
OS: XPSP2
CPU/Ram: P4 1024
Comment:

I am trying to make a batch file that will empty all sub-directories of a certain name. The contents of these directories is not important (can be deleted), but the directory itself needs to remain intact.

They are basically junk collection directories that need emptying, all over the place and always called "Junk". DEL, RD, DELTREE don't seem to be suitable. IF EXIST might work, but I don't know how to make it interrogate all subdirectories. Any help?

Dan




Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: July 15, 2005 at 10:35:36 Pacific
Reply:

::== nojunk.bat
@echo off

dir /s/b/ad \junk*.* > junklist
for /f %%J in (junklist) do del %%J /Q
::==


M2


If at first you don't succeed, you're about average.


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch file to remove directories

Batch File to remove files www.computing.net/answers/programming/batch-file-to-remove-files-/16226.html

Batch File To Remove Certain Lines2 www.computing.net/answers/programming/batch-file-to-remove-certain-lines2/17237.html

Batch File to find directory and co www.computing.net/answers/programming/batch-file-to-find-directory-and-co/15664.html