#1 23 Aug 2016 15:02

jaykappy
New Member
Registered: 23 Aug 2016
Posts: 1

Delete all but specific file

I am trying to run a command that will search a bunc h of folders and DELETE ALL files EXCEPT a specific file.

I am using this right now.

for %i in (*) do if not %i == .msg del %i

Questions:
1. This does not work on subfolders.  How do I modify it to do so?
2. How do I specify more than one type of file to KEEP (right now only the .msg are kept)

PLEASE HELP!!!!!  Cheers

Offline

#2 24 Aug 2016 15:05

Simon Sheppard
Super Administrator
Registered: 27 Aug 2005
Posts: 867
Website

Re: Delete all but specific file

see this previous thread
http://ss64.org/viewtopic.php?id=1152

Offline

Board footer

Powered by FluxBB