How to purge everything from shared folder every night

Perhaps you have in company shared folder for exchange of non-confidential large files, temp files and so on.

To clean every night this folder :

  • create on d disk folder stack/buffer or whatever you like,
  • share it
  • schedule bat file with following content:
    rem "Be carefull to be inside of stack folder!!!!"
    cd d:\stack
    del * /s /q
    for /f "delims=" %%d in ('dir /s /b /ad') do rmdir /s/q "%%d"

IMPORTANT: Be very careful with this script, if you run it in improper place you will delete everything recursively !!!