Link to home
Start Free TrialLog in
Avatar of Luis Diaz
Luis DiazFlag for Colombia

asked on

CMD: fast way to remove files based on extension (exclude & include extensions)

Hello,

I am looking for a fast way to

1-Delete files with specific extensions .log, .txt .pdf

2-Delete files and exclude files with specific extensions such as .log, txt
Thank you very much for your help.
Avatar of Olivier Marchetta
Olivier Marchetta
Flag of United Kingdom of Great Britain and Northern Ireland image

For point 2:

If this is for a file server then you may want to install the role File Server Resource Manager (File and Storage Services server role / File and iSCSI services / File Server Resource Manager) and define a "File Screen".  The File Screen policy will allow you to excludes files.
EXPERT CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Luis Diaz

ASKER

Thank you oBda, could you please help me to adapt the command by calling powershell.exe through cmd?
EXPERT CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you very much! It works! Can someone provide cmd & windows batch approach?
Avatar of Bill Prew
Bill Prew

Thank you very much! It works! Can someone provide cmd & windows batch approach?
Do you want to recursively drill into subfolders, or just the top level folder?


»bp
Both if possible.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you very much for those helpful proposals!