1.

Solve : MS Dos Small Program Help?

Answer»

Hi i'm CONSTRUCTING a program that deletes MP3's, WAV's etc from a particular drive.
WHat i want it to do is export what it has deleted to a txt document can you ADVISE the write code to use please this is what i have so far:-

Color 1F

cls

@ECHO Deleting The Following File Types From The Students Home Drives:-
@ECHO MP3, WMA, WAV, EXE, WMV and CDA

@ECHO This Program Will Loop Until Closed

@ECHO OFF
:Start

Start
del /s /q /F Z:\*.mp3
del /s /q /f Z:\*.wma
del /s /q /f Z:\*.wav
del /s /q /f Z:\*.exe
del /s /q /f Z:\*.wmv
del /s /q /f Z:\*.cda

:GOTO Start

:END

EXIT

any help appreciated

Richdel /s /q /f Z:\*.mp3 >>log.txt

should do the job.

hope it helps
uliyou got to modify a bit

Code: [Select]for /f "delims=" %%a in ('dir /s /b /a-d z:\*mp3') do (
del /f %%a
if %errorlevel% EQU 0 echo %%a deleted >> output.txt
)

Do the same for the rest of the file typesthanks, so will this replace or just add to the file for successive file types if repeated?

regards

Richard DaleQuote

thanks, so will this replace or just add to the file for successive file types if repeated?

regards

Richard Dale

using >> will append your results to the output file.for /R z:\ %%a in (*.MP3 *.WMA *.WAV *.EXE *.WMV *.CDA ) do (
del /f %%a
)

does all filetypes in one loop recursive.
(The if statement doesn`t work on my NT4 machine in a for loop.
Seems that I have to call a procedure)that program just deleted everything of my hardrive

Richwow...always do a test first before using del /fQuote
that program just deleted everything of my hardrive

Rich


Strange.
I did a test (with echo); it echoed only the SAID filetypes.

uliQuote
Quote
that program just deleted everything of my hardrive

Rich


Strange.
I did a test (with echo); it echoed only the said filetypes.

uli


probably substitued the "z:\" for "c:\"


Discussion

No Comment Found