Search code examples
windowsbatch-filecmddelete-filewindows-server-2012

Deleting a folder that contains large amount of files and showing the files that are being deleted


I am deleting a folder that contains large amount of files (Milions of files) under Windows Server 2012 and i am using this command for this purpose :

rmdir /s/q foldername

Is there a way i can see the files that are being deleted in the cmd window?


Solution

  • If you use DEL to delete the files and RMDIR to delete the directories afterwards, you get your desired behaviour:

    DEL /Q /S foldername\* && RMDIR /Q /S foldername