Tag Archives: dir

Delete files and folders with long names in Windows

four-file-folders
Using command line you can delete files and folders with long names:

  rmdir /S /Q <FOLDER_NAME_TO_DELETE>

Clear folder (subfolders and files) in BATCH

To delete all files and subfolders in given directory, you can use next snippet:

    @echo off  
    setlocal enableextensions enabledelayedexpansion  

    set pathDirToClear=C:\Tmp  
      
    for /d %%A in (%pathDirToClear%) do (  
        if exist %%A (  
            del /F /Q %%A\*  
            for /d %%B in (%%A\*) do (  
                rd /S /Q %%B  
            )  
        )  
    )