title: Batch file to delete folders older than N days except specific ones
body: <p>I'm looking to make a batch file to delete profiles that haven't been used in over 6 months while retaining specific ones such as "Administrator, Default User, All Users, etc."</p>
  
  <p>I've searched all around and have found a way to remove older files/folders: </p>
  
  <p>forfiles.exe /p D:\Files /s /m <em>.</em> /d -7 /c "cmd /c del @file"</p>
  
  <p>But there's no way of making an exception with "forfiles"</p>
  
  <p>I've also found a way to delete files/folders with exceptions:</p>
  
  <p>for %%i in (*.exe) do if not "%%i"=="file name" del /q "%%i"</p>
  
  <p>But that'll remove every file/folder and not just older ones.</p>
  
  <p>My scenario:
  I take care of hundreds of workstations which run WinXP. There are several users that log in to these computers and I wouldn't want to delete their accounts. Only those who haven't logged in in a while and the exception of 3 or 4 permanent accounts in each workstation which are always the same. So, if no one has logged in to an Administrator account in over 6 months, I would like for it to stay intact. I can't drop forfiles into all of these workstations or any other piece of software so I'm limited on my capabilities.</p>
  
  <p>Can anyone help?</p>