Delete folder/files | CL

Methods to delete files via command line: Normally I take ownership of the folder/files (takeown):

takeown /f c:\folder\location /r /d y
  • /r Performs a recursive operation on all files/folders.
  • /d Suppresses the confirmation prompt.
  • y Yes Take ownership of the directory.

Change Permission (icacls):

icacls c:\folder\location /grant administrators:F /t
  • /t Performs a recursive operation on all files/folders.

Delete Process (del): 

del c:\folder\location\*.* /s /q
  • /q Quiet mode, do not ask if ok to delete on global wildcard
  • /s Delete specified files from all sub-directories (DELTREE).
  • /f Force deleting of read-only files.

Delete Process (RD):

RD /S /Q c:\folder\location\
  •  /q Quiet mode, do not ask if OK to delete on global wildcard
  • /s Delete specified files from all sub-directories.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.