Wednesday, 6 September 2017

Delete all the files and folders inside a folder in DOS



Greetings!!

Recently i faced a scenario where i was unable to delete the log files because of some error related to path being too large.

After some thought, decided to use the DOS to achieve the same. Tried several commands such as del, deltree, rm, rmdir etc.

The command that I found to be the most effective was as below:

cd c:\Performance\logs [Command to navigate to the logs folder]
rd . /q /s                           [Command to delete all the files in this logs folder]



Please make note of the “.” in this command. 

Note: Because you are in c:\Performance\logs, it will fail to remove that folder but everything else will be deleted.

Cheers!!

No comments:

Post a Comment