I am sure there is an easier way to achieve this, but looking through my
scripts, I had to fudge this at one time, as rmdir will remove the root
directory as you say

What I did was



*del c:\directory\*.* /Q

*and then*

for /f "tokens=4" %%a in ('dir c:\directory^|find "<DIR>"^|find /v "."') do
set dir=%%a& call :RMDIR

goto :eof

:RMDIR

rmdir c:\directory\%dir% /S /Q*



Seems very long-winded and I would be surprised if someone on the list
hasn't got a far easier way to do this. I must have been in a rush when I
cobbled that lot together!

Cheers,

2008/10/28 Doige, Clayton <[EMAIL PROTECTED]>

>  If I use that, will it remove the root directory as well, or just the sub
> directory stuff?
>
>
>
> Eg:  rmdir c:\directory /q /s
>
>
>
> Will that leave me with c:\directory, or just c:\?
>
>
>
> thanks
>
>
>
> *Clayton Doige*
>
> IT Project Manager
>
> *C**M**E** Development Corporation*
>
> T: 020 7430 5355
>
> M: 07949 255062
>
> E:[EMAIL PROTECTED]
>
> W:www.cetv-net.com
>
> *From:* James Rankin [mailto:[EMAIL PROTECTED]
> *Sent:* 28 October 2008 12:36
> *To:* NT System Admin Issues
> *Subject:* Re: Slightly OT DOS Syntax Q
>
>
>
> Try using rmdir instead
>
> 2008/10/28 Clayton Doige <[EMAIL PROTECTED]>
>
> Dusting off some DOS and drawing a mind blank.
>
>
>
> Wrote a short little batch file with the idea being that everything (files
> and folders) within in a certain directory is blown out everyday. Goes like
> this:
>
>
>
> del c:\directory\ *.* /Q /S
>
>
>
> this proceeds to delete every file in every subdirectory without user
> intervention, however it leaves the subfolders in place.
>
>
>
> What switch do I use to get rid of the folders as well?
>
>
>
> Thanks
>
>
>
> Clayton
>
>
>
>
>
>
>
>
>
>
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> ______________________________________________________________________
>
> ______________________________________________________________________
> This electronic mail message and any attached files contain information
> intended for the exclusive use of the person(s) to whom it is addressed and
> may contain information that is proprietary, privileged, confidential and/or
> exempt from disclosure under applicable law. If you are not the intended
> recipient, you are hereby notified that any viewing, copying, disclosure or
> distribution of this message or its contents may be subject to legal
> restriction or sanction. If you have received this message in error, please
> notify the sender immediately by electronic mail and delete the original
> message and any attachments without retaining any copies.
> _____________________________________________________________________
>
>
>
>
>
>

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

Reply via email to