Delete files or folder recursively on Windows CMD

后端 未结 12 1360
悲哀的现实
悲哀的现实 2020-12-02 08:30

How do I delete files or folders recursively on Windows from the command line?

I have found this solution where path we drive on the command line and run this comman

相关标签:
12条回答
  • 2020-12-02 08:32

    For completely wiping a folder with native commands and getting a log on what's been done.

    here's an unusual way to do it :

    let's assume we want to clear the d:\temp dir

    mkdir d:\empty
    robocopy /mir d:\empty d:\temp
    rmdir d:\empty
    
    0 讨论(0)
  • 2020-12-02 08:35

    If you want to delete a specific extension recursively, use this:

    For /R "C:\Users\Desktop\saleh" %G IN (*.ppt) do del "%G"
    
    0 讨论(0)
  • 2020-12-02 08:35

    After the blog post How Can I Use Windows PowerShell to Delete All the .TMP Files on a Drive?, you can use something like this to delete all .tmp for example from a folder and all subfolders in PowerShell:

    get-childitem [your path/ or leave empty for current path] -include
    *.tmp -recurse | foreach ($_) {remove-item $_.fullname}
    
    0 讨论(0)
  • 2020-12-02 08:36

    Please execute the following steps:

    1. Open the command prompt
    2. Change directory to the required path
    3. Give the following command

      del /S *.svn
      
    0 讨论(0)
  • 2020-12-02 08:37
    dir /b %temp% >temp.list
    for /f "delims=" %%a in (temp.list) do call rundll32.exe advpack.dll,DelNodeRunDLL32 "%temp%\%%a"
    
    0 讨论(0)
  • 2020-12-02 08:42
    RMDIR path_to_folder /S
    

    ex. RMDIR "C:\tmp" /S

    Note that you'll be prompted if you're really going to delete the "C:\tmp" folder. Combining it with /Q switch will remove the folder silently (ex. RMDIR "C:\tmp" /S /Q)

    0 讨论(0)
提交回复
热议问题