Link to home
Create AccountLog in
Microsoft DOS

Microsoft DOS

--

Questions

--

Followers

Top Experts

Avatar of wasabi3689
wasabi3689🇺🇸

How do I delete
I have a folder with several sub direcrorries and then files, How can I run a Dos command to detele all MS Word file only .doc? Also, I want to log the output for the file deleted ( file names).

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


ASKER CERTIFIED SOLUTION
Avatar of Bill PrewBill Prew

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Avatar of Bill PrewBill Prew

Here's a small BAT script that will log file names.

@echo off

set BaseDir=c:\basefolder
set LogFile=c:\temp\dellog.txt

(
  for /f "tokens=*" %%A in ('dir /b /s /a-d "c:\basefolder\*.doc"') do (
    echo Deleting: %%A
    del "%%~A"
  )
)>"%LogFile%"

Open in new window

~bp

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.

Microsoft DOS

Microsoft DOS

--

Questions

--

Followers

Top Experts

Microsoft Disk Operating System (MS-DOS) was an operating system for x86-based personal computers, and traces of it are still found in the Windows operating system. DOS is still used in some embedded systems and for certain legacy 16-bit networks.