Sign in with
Sign up | Sign in
Your question

Batch File Help

Last response: in Windows 2000/NT
Share
Anonymous
August 26, 2005 11:15:44 AM

Archived from groups: microsoft.public.win2000.general (More info?)

I'm trying to write a batch file to delete the contents of a directory on
the c drive and the subfolders with in it. In the old days I used DELTREE,
but I guess it isn't in XP/2000.

Can someone tell me how do delete the Folder1 and all it's contents:

C:\Folder1\pictures\open issue\*.jpg

Thanks.

More about : batch file

Anonymous
August 26, 2005 11:26:04 AM

Archived from groups: microsoft.public.win2000.general (More info?)

I too am trying to write a batch file so I can delete the files and sub
directories under the temp folder (C:\Documents and Settings\user\Local
Settings\Temp) so I would really like to see how this is done.

All help is greatly appreciated.

~Olam


"FJ" wrote:

> I'm trying to write a batch file to delete the contents of a directory on
> the c drive and the subfolders with in it. In the old days I used DELTREE,
> but I guess it isn't in XP/2000.
>
> Can someone tell me how do delete the Folder1 and all it's contents:
>
> C:\Folder1\pictures\open issue\*.jpg
>
> Thanks.
>
>
>
Anonymous
August 26, 2005 12:44:44 PM

Archived from groups: microsoft.public.win2000.general (More info?)

Figured it out:
Use the rmdir command
rmdir folder1 /S /Q

"Olam" <Olam@discussions.microsoft.com> wrote in message
news:FD4A0746-D5A9-4EE4-964D-C625EED26594@microsoft.com...
>I too am trying to write a batch file so I can delete the files and sub
> directories under the temp folder (C:\Documents and Settings\user\Local
> Settings\Temp) so I would really like to see how this is done.
>
> All help is greatly appreciated.
>
> ~Olam
>
>
> "FJ" wrote:
>
>> I'm trying to write a batch file to delete the contents of a directory on
>> the c drive and the subfolders with in it. In the old days I used
>> DELTREE,
>> but I guess it isn't in XP/2000.
>>
>> Can someone tell me how do delete the Folder1 and all it's contents:
>>
>> C:\Folder1\pictures\open issue\*.jpg
>>
>> Thanks.
>>
>>
>>
Related resources
Anonymous
August 26, 2005 1:02:12 PM

Archived from groups: microsoft.public.win2000.general (More info?)

I still cannot get mine to work. This is what I have in my bat/cmd file
rmdir /S /Q "C:\Documents and Settings\Jeremy Johnston\Local
Settings\Temp\*.*"
I get the following error at the cmd prompt
The filename, directory name, or volume label syntax is incorrect.

At first I had it deleting all the files in the temp but it left all of the
sub directories. ???


"FJ" wrote:

> Figured it out:
> Use the rmdir command
> rmdir folder1 /S /Q
>
> "Olam" <Olam@discussions.microsoft.com> wrote in message
> news:FD4A0746-D5A9-4EE4-964D-C625EED26594@microsoft.com...
> >I too am trying to write a batch file so I can delete the files and sub
> > directories under the temp folder (C:\Documents and Settings\user\Local
> > Settings\Temp) so I would really like to see how this is done.
> >
> > All help is greatly appreciated.
> >
> > ~Olam
> >
> >
> > "FJ" wrote:
> >
> >> I'm trying to write a batch file to delete the contents of a directory on
> >> the c drive and the subfolders with in it. In the old days I used
> >> DELTREE,
> >> but I guess it isn't in XP/2000.
> >>
> >> Can someone tell me how do delete the Folder1 and all it's contents:
> >>
> >> C:\Folder1\pictures\open issue\*.jpg
> >>
> >> Thanks.
> >>
> >>
> >>
>
>
>
Anonymous
August 26, 2005 10:33:40 PM

Archived from groups: microsoft.public.win2000.general (More info?)

Olam wrote:

> I still cannot get mine to work. This is what I have in my bat/cmd file
> rmdir /S /Q "C:\Documents and Settings\Jeremy Johnston\Local
> Settings\Temp\*.*"
> I get the following error at the cmd prompt
> The filename, directory name, or volume label syntax is incorrect.
>
> At first I had it deleting all the files in the temp but it left all of the
> sub directories. ???
>
Hi,

See tip 617 in the 'Tips & Tricks' at http://www.jsiinc.com/reghack.htm

DELTREE.BAT "c:\My Test Folder"

To delete files and sub directories under the temp folder:

DELTREE.BAT "%USERPROFILE%\Local Settings\Temp"


Deltree.bat contains:

@echo off
pushd %1
del /q *.*
for /f "Tokens=*" %%i in ('dir /B') do rd /s /q "%%i"
popd





--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.m...
!